Examples of Weapon


Examples of clueless.model.Weapon

        selectedCharacter = new Character(character.getType());
      }
      else if(button instanceof WeaponButton)
      {
        WeaponButton weapon = (WeaponButton)button;
        selectedWeapon = new Weapon(weapon.getType());
      }
      else if(button instanceof RoomButton)
      {
        RoomButton location = (RoomButton)button;
        selectedRoom = new Room(location.getType());
View Full Code Here

Examples of clueless.model.Weapon

        selectedCharacter = new clueless.model.Character(character.getType());
      }
      else if(button instanceof WeaponButton)
      {
        WeaponButton weapon = (WeaponButton)button;
        selectedWeapon = new Weapon(weapon.getType());
      }
      else if(button instanceof RoomButton)
      {
        RoomButton location = (RoomButton)button;
        selectedRoom = new Room(location.getType());
View Full Code Here

Examples of edu.ups.gamedev.weapons.Weapon

    // attach everything
    root.attachChild(playerTank);

    playerTank.setLocalTranslation(10, 200, 10);
    playerTank.setPrimaryWeapon(new Weapon(CannonFireable.class, new TeapotPlacingWarhead(), .2f));
    playerTank.setSecondaryWeapon(new Weapon(MissileFireable.class,  new KineticWarhead(), .2f));
    playerTank.addController(new TankController(playerTank));
   
    //register the player
    try {
      net.register(player.getControlledObject(), NetworkConstants.TANK);
View Full Code Here

Examples of gwlpr.database.entities.Weapon

            if (leadhand != null) {
                leadhand.getWeaponCollection().add(weapon);
                leadhand = em.merge(leadhand);
            }
            for (Npc npcCollectionNpc : weapon.getNpcCollection()) {
                Weapon oldWeaponsOfNpcCollectionNpc = npcCollectionNpc.getWeapons();
                npcCollectionNpc.setWeapons(weapon);
                npcCollectionNpc = em.merge(npcCollectionNpc);
                if (oldWeaponsOfNpcCollectionNpc != null) {
                    oldWeaponsOfNpcCollectionNpc.getNpcCollection().remove(npcCollectionNpc);
                    oldWeaponsOfNpcCollectionNpc = em.merge(oldWeaponsOfNpcCollectionNpc);
                }
            }
            for (Weaponset weaponsetCollectionWeaponset : weapon.getWeaponsetCollection()) {
                Weapon oldWeaponsOfWeaponsetCollectionWeaponset = weaponsetCollectionWeaponset.getWeapons();
                weaponsetCollectionWeaponset.setWeapons(weapon);
                weaponsetCollectionWeaponset = em.merge(weaponsetCollectionWeaponset);
                if (oldWeaponsOfWeaponsetCollectionWeaponset != null) {
                    oldWeaponsOfWeaponsetCollectionWeaponset.getWeaponsetCollection().remove(weaponsetCollectionWeaponset);
                    oldWeaponsOfWeaponsetCollectionWeaponset = em.merge(oldWeaponsOfWeaponsetCollectionWeaponset);
                }
            }
            em.getTransaction().commit();
        } finally {
View Full Code Here

Examples of gwlpr.database.entities.Weapon

    public void edit(Weapon weapon) throws IllegalOrphanException, NonexistentEntityException, Exception {
        EntityManager em = null;
        try {
            em = getEntityManager();
            em.getTransaction().begin();
            Weapon persistentWeapon = em.find(Weapon.class, weapon.getId());
            Item offhandOld = persistentWeapon.getOffhand();
            Item offhandNew = weapon.getOffhand();
            Item leadhandOld = persistentWeapon.getLeadhand();
            Item leadhandNew = weapon.getLeadhand();
            Collection<Npc> npcCollectionOld = persistentWeapon.getNpcCollection();
            Collection<Npc> npcCollectionNew = weapon.getNpcCollection();
            Collection<Weaponset> weaponsetCollectionOld = persistentWeapon.getWeaponsetCollection();
            Collection<Weaponset> weaponsetCollectionNew = weapon.getWeaponsetCollection();
            List<String> illegalOrphanMessages = null;
            for (Npc npcCollectionOldNpc : npcCollectionOld) {
                if (!npcCollectionNew.contains(npcCollectionOldNpc)) {
                    if (illegalOrphanMessages == null) {
                        illegalOrphanMessages = new ArrayList<String>();
                    }
                    illegalOrphanMessages.add("You must retain Npc " + npcCollectionOldNpc + " since its weapons field is not nullable.");
                }
            }
            for (Weaponset weaponsetCollectionOldWeaponset : weaponsetCollectionOld) {
                if (!weaponsetCollectionNew.contains(weaponsetCollectionOldWeaponset)) {
                    if (illegalOrphanMessages == null) {
                        illegalOrphanMessages = new ArrayList<String>();
                    }
                    illegalOrphanMessages.add("You must retain Weaponset " + weaponsetCollectionOldWeaponset + " since its weapons field is not nullable.");
                }
            }
            if (illegalOrphanMessages != null) {
                throw new IllegalOrphanException(illegalOrphanMessages);
            }
            if (offhandNew != null) {
                offhandNew = em.getReference(offhandNew.getClass(), offhandNew.getId());
                weapon.setOffhand(offhandNew);
            }
            if (leadhandNew != null) {
                leadhandNew = em.getReference(leadhandNew.getClass(), leadhandNew.getId());
                weapon.setLeadhand(leadhandNew);
            }
            Collection<Npc> attachedNpcCollectionNew = new ArrayList<Npc>();
            for (Npc npcCollectionNewNpcToAttach : npcCollectionNew) {
                npcCollectionNewNpcToAttach = em.getReference(npcCollectionNewNpcToAttach.getClass(), npcCollectionNewNpcToAttach.getId());
                attachedNpcCollectionNew.add(npcCollectionNewNpcToAttach);
            }
            npcCollectionNew = attachedNpcCollectionNew;
            weapon.setNpcCollection(npcCollectionNew);
            Collection<Weaponset> attachedWeaponsetCollectionNew = new ArrayList<Weaponset>();
            for (Weaponset weaponsetCollectionNewWeaponsetToAttach : weaponsetCollectionNew) {
                weaponsetCollectionNewWeaponsetToAttach = em.getReference(weaponsetCollectionNewWeaponsetToAttach.getClass(), weaponsetCollectionNewWeaponsetToAttach.getWeaponsetPK());
                attachedWeaponsetCollectionNew.add(weaponsetCollectionNewWeaponsetToAttach);
            }
            weaponsetCollectionNew = attachedWeaponsetCollectionNew;
            weapon.setWeaponsetCollection(weaponsetCollectionNew);
            weapon = em.merge(weapon);
            if (offhandOld != null && !offhandOld.equals(offhandNew)) {
                offhandOld.getWeaponCollection().remove(weapon);
                offhandOld = em.merge(offhandOld);
            }
            if (offhandNew != null && !offhandNew.equals(offhandOld)) {
                offhandNew.getWeaponCollection().add(weapon);
                offhandNew = em.merge(offhandNew);
            }
            if (leadhandOld != null && !leadhandOld.equals(leadhandNew)) {
                leadhandOld.getWeaponCollection().remove(weapon);
                leadhandOld = em.merge(leadhandOld);
            }
            if (leadhandNew != null && !leadhandNew.equals(leadhandOld)) {
                leadhandNew.getWeaponCollection().add(weapon);
                leadhandNew = em.merge(leadhandNew);
            }
            for (Npc npcCollectionNewNpc : npcCollectionNew) {
                if (!npcCollectionOld.contains(npcCollectionNewNpc)) {
                    Weapon oldWeaponsOfNpcCollectionNewNpc = npcCollectionNewNpc.getWeapons();
                    npcCollectionNewNpc.setWeapons(weapon);
                    npcCollectionNewNpc = em.merge(npcCollectionNewNpc);
                    if (oldWeaponsOfNpcCollectionNewNpc != null && !oldWeaponsOfNpcCollectionNewNpc.equals(weapon)) {
                        oldWeaponsOfNpcCollectionNewNpc.getNpcCollection().remove(npcCollectionNewNpc);
                        oldWeaponsOfNpcCollectionNewNpc = em.merge(oldWeaponsOfNpcCollectionNewNpc);
                    }
                }
            }
            for (Weaponset weaponsetCollectionNewWeaponset : weaponsetCollectionNew) {
                if (!weaponsetCollectionOld.contains(weaponsetCollectionNewWeaponset)) {
                    Weapon oldWeaponsOfWeaponsetCollectionNewWeaponset = weaponsetCollectionNewWeaponset.getWeapons();
                    weaponsetCollectionNewWeaponset.setWeapons(weapon);
                    weaponsetCollectionNewWeaponset = em.merge(weaponsetCollectionNewWeaponset);
                    if (oldWeaponsOfWeaponsetCollectionNewWeaponset != null && !oldWeaponsOfWeaponsetCollectionNewWeaponset.equals(weapon)) {
                        oldWeaponsOfWeaponsetCollectionNewWeaponset.getWeaponsetCollection().remove(weaponsetCollectionNewWeaponset);
                        oldWeaponsOfWeaponsetCollectionNewWeaponset = em.merge(oldWeaponsOfWeaponsetCollectionNewWeaponset);
                    }
                }
            }
            em.getTransaction().commit();
View Full Code Here

Examples of gwlpr.database.entities.Weapon

    public void destroy(Integer id) throws IllegalOrphanException, NonexistentEntityException {
        EntityManager em = null;
        try {
            em = getEntityManager();
            em.getTransaction().begin();
            Weapon weapon;
            try {
                weapon = em.getReference(Weapon.class, id);
                weapon.getId();
            } catch (EntityNotFoundException enfe) {
                throw new NonexistentEntityException("The weapon with id " + id + " no longer exists.", enfe);
            }
            List<String> illegalOrphanMessages = null;
            Collection<Npc> npcCollectionOrphanCheck = weapon.getNpcCollection();
            for (Npc npcCollectionOrphanCheckNpc : npcCollectionOrphanCheck) {
                if (illegalOrphanMessages == null) {
                    illegalOrphanMessages = new ArrayList<String>();
                }
                illegalOrphanMessages.add("This Weapon (" + weapon + ") cannot be destroyed since the Npc " + npcCollectionOrphanCheckNpc + " in its npcCollection field has a non-nullable weapons field.");
            }
            Collection<Weaponset> weaponsetCollectionOrphanCheck = weapon.getWeaponsetCollection();
            for (Weaponset weaponsetCollectionOrphanCheckWeaponset : weaponsetCollectionOrphanCheck) {
                if (illegalOrphanMessages == null) {
                    illegalOrphanMessages = new ArrayList<String>();
                }
                illegalOrphanMessages.add("This Weapon (" + weapon + ") cannot be destroyed since the Weaponset " + weaponsetCollectionOrphanCheckWeaponset + " in its weaponsetCollection field has a non-nullable weapons field.");
            }
            if (illegalOrphanMessages != null) {
                throw new IllegalOrphanException(illegalOrphanMessages);
            }
            Item offhand = weapon.getOffhand();
            if (offhand != null) {
                offhand.getWeaponCollection().remove(weapon);
                offhand = em.merge(offhand);
            }
            Item leadhand = weapon.getLeadhand();
            if (leadhand != null) {
                leadhand.getWeaponCollection().remove(weapon);
                leadhand = em.merge(leadhand);
            }
            em.remove(weapon);
View Full Code Here

Examples of gwlpr.database.entities.Weapon

    public void create(Npc npc) {
        EntityManager em = null;
        try {
            em = getEntityManager();
            em.getTransaction().begin();
            Weapon weapons = npc.getWeapons();
            if (weapons != null) {
                weapons = em.getReference(weapons.getClass(), weapons.getId());
                npc.setWeapons(weapons);
            }
            em.persist(npc);
            if (weapons != null) {
                weapons.getNpcCollection().add(npc);
                weapons = em.merge(weapons);
            }
            em.getTransaction().commit();
        } finally {
            if (em != null) {
View Full Code Here

Examples of gwlpr.database.entities.Weapon

        EntityManager em = null;
        try {
            em = getEntityManager();
            em.getTransaction().begin();
            Npc persistentNpc = em.find(Npc.class, npc.getId());
            Weapon weaponsOld = persistentNpc.getWeapons();
            Weapon weaponsNew = npc.getWeapons();
            if (weaponsNew != null) {
                weaponsNew = em.getReference(weaponsNew.getClass(), weaponsNew.getId());
                npc.setWeapons(weaponsNew);
            }
            npc = em.merge(npc);
            if (weaponsOld != null && !weaponsOld.equals(weaponsNew)) {
                weaponsOld.getNpcCollection().remove(npc);
                weaponsOld = em.merge(weaponsOld);
            }
            if (weaponsNew != null && !weaponsNew.equals(weaponsOld)) {
                weaponsNew.getNpcCollection().add(npc);
                weaponsNew = em.merge(weaponsNew);
            }
            em.getTransaction().commit();
        } catch (Exception ex) {
            String msg = ex.getLocalizedMessage();
View Full Code Here

Examples of gwlpr.database.entities.Weapon

                npc = em.getReference(Npc.class, id);
                npc.getId();
            } catch (EntityNotFoundException enfe) {
                throw new NonexistentEntityException("The npc with id " + id + " no longer exists.", enfe);
            }
            Weapon weapons = npc.getWeapons();
            if (weapons != null) {
                weapons.getNpcCollection().remove(npc);
                weapons = em.merge(weapons);
            }
            em.remove(npc);
            em.getTransaction().commit();
        } finally {
View Full Code Here

Examples of gwlpr.database.entities.Weapon

        weaponset.getWeaponsetPK().setCharacterID(weaponset.getCharacter().getId());
        EntityManager em = null;
        try {
            em = getEntityManager();
            em.getTransaction().begin();
            Weapon weapons = weaponset.getWeapons();
            if (weapons != null) {
                weapons = em.getReference(weapons.getClass(), weapons.getId());
                weaponset.setWeapons(weapons);
            }
            Character character = weaponset.getCharacter();
            if (character != null) {
                character = em.getReference(character.getClass(), character.getId());
                weaponset.setCharacter(character);
            }
            em.persist(weaponset);
            if (weapons != null) {
                weapons.getWeaponsetCollection().add(weaponset);
                weapons = em.merge(weapons);
            }
            if (character != null) {
                character.getWeaponsetCollection().add(weaponset);
                character = em.merge(character);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.