Aion Gates
Would you like to react to this message? Create an account in a few clicks or log in to continue.

plasticsurgery&genderswitch.patch

Go down

plasticsurgery&genderswitch.patch Empty plasticsurgery&genderswitch.patch

Post  M@xx Mon 13 Sep - 17:20

Code:

### Eclipse Workspace Patch 1.0
#P AL-Game-clean
Index: src/main/java/com/aionemu/gameserver/network/aion/ServerPacketsOpcodes.java
===================================================================
--- src/main/java/com/aionemu/gameserver/network/aion/ServerPacketsOpcodes.java   (revision 288)
+++ src/main/java/com/aionemu/gameserver/network/aion/ServerPacketsOpcodes.java   (working copy)
@@ -118,6 +118,7 @@
       addPacketOpcode(SM_EXCHANGE_ADD_KINAH.class, 0x6B, idSet);// 1.9
       addPacketOpcode(SM_EMOTION_LIST.class, 0x6D, idSet);// 1.9
       addPacketOpcode(SM_TARGET_UPDATE.class, 0x6F, idSet);// 1.9
+      addPacketOpcode(SM_PLASTIC_SURGERY.class, 0x71, idSet);// 1.9
       addPacketOpcode(SM_LEGION_UPDATE_SELF_INTRO.class, 0x75, idSet);// 1.9
       addPacketOpcode(SM_RIFT_STATUS.class, 0x76, idSet); // 1.9
       addPacketOpcode(SM_QUEST_ACCEPTED.class, 0x78, idSet);// 1.9
Index: data/scripts/system/database/mysql5/MySQL5PlayerDAO.java
===================================================================
--- data/scripts/system/database/mysql5/MySQL5PlayerDAO.java   (revision 288)
+++ data/scripts/system/database/mysql5/MySQL5PlayerDAO.java   (working copy)
@@ -97,7 +97,7 @@
       {
          con = DatabaseFactory.getConnection();
          PreparedStatement stmt = con.prepareStatement(
-            "UPDATE players SET name=?, exp=?, recoverexp=?, x=?, y=?, z=?, heading=?, world_id=?, player_class=?, last_online=?, cube_size=?, advenced_stigma_slot_size=?, warehouse_size=?, note=?, bind_point=?, title_id=?, mailboxLetters=? WHERE id=?");
+            "UPDATE players SET name=?, exp=?, recoverexp=?, x=?, y=?, z=?, heading=?, world_id=?, gender=?, player_class=?, last_online=?, cube_size=?, advenced_stigma_slot_size=?, warehouse_size=?, note=?, bind_point=?, title_id=?, mailboxLetters=? WHERE id=?");
 
          log.debug("[DAO: MySQL5PlayerDAO] storing player "+player.getObjectId()+" "+player.getName());
 
@@ -109,20 +109,21 @@
             stmt.setFloat(6, player.getZ());
             stmt.setInt(7, player.getHeading());
             stmt.setInt(8, player.getWorldId());
-            stmt.setString(9, player.getCommonData().getPlayerClass().toString());
-            stmt.setTimestamp(10, player.getCommonData().getLastOnline());
-            stmt.setInt(11, player.getCubeSize());
-            stmt.setInt(12, player.getCommonData().getAdvencedStigmaSlotSize());
-            stmt.setInt(13, player.getWarehouseSize());
-            stmt.setString(14,player.getCommonData().getNote());
-            stmt.setInt(15, player.getCommonData().getBindPoint());
-            stmt.setInt(16, player.getCommonData().getTitleId());
+            stmt.setString(9, player.getGender().toString());
+            stmt.setString(10, player.getCommonData().getPlayerClass().toString());
+            stmt.setTimestamp(11, player.getCommonData().getLastOnline());
+            stmt.setInt(12, player.getCubeSize());
+            stmt.setInt(13, player.getCommonData().getAdvencedStigmaSlotSize());
+            stmt.setInt(14, player.getWarehouseSize());
+            stmt.setString(15,player.getCommonData().getNote());
+            stmt.setInt(16, player.getCommonData().getBindPoint());
+            stmt.setInt(17, player.getCommonData().getTitleId());
             
             Mailbox mailBox = player.getMailbox();
             int mails = mailBox != null ? mailBox.size() : player.getCommonData().getMailboxLetters();
-            stmt.setInt(17, mails);
+            stmt.setInt(18, mails);
             
-            stmt.setInt(18, player.getObjectId());
+            stmt.setInt(19, player.getObjectId());
             stmt.execute();
             stmt.close();
          }
Index: src/main/java/com/aionemu/gameserver/network/aion/clientpackets/CM_ENTER_WORLD.java
===================================================================
--- src/main/java/com/aionemu/gameserver/network/aion/clientpackets/CM_ENTER_WORLD.java   (revision 288)
+++ src/main/java/com/aionemu/gameserver/network/aion/clientpackets/CM_ENTER_WORLD.java   (working copy)
@@ -107,6 +107,11 @@
    protected void runImpl()
    {
       AionConnection client = getConnection();
+      enterWorld(client, objectId);
+   }
+   
+   public static void enterWorld(AionConnection client, int objectId)
+   {
       Account account = client.getAccount();
       PlayerAccountData playerAccData = client.getAccount().getPlayerAccountData(objectId);
 
@@ -133,30 +138,30 @@
          World.getInstance().storeObject(player);
 
          StigmaService.onPlayerLogin(player);
-         sendPacket(new SM_SKILL_LIST(player));
+         client.sendPacket(new SM_SKILL_LIST(player));
          
          if(player.getSkillCoolDowns() != null)
-            sendPacket(new SM_SKILL_COOLDOWN(player.getSkillCoolDowns()));
+            client.sendPacket(new SM_SKILL_COOLDOWN(player.getSkillCoolDowns()));
          
          if(player.getItemCoolDowns() != null)
-            sendPacket(new SM_ITEM_COOLDOWN(player.getItemCoolDowns()));
+            client.sendPacket(new SM_ITEM_COOLDOWN(player.getItemCoolDowns()));
 
-         sendPacket(new SM_QUEST_LIST(player));
-         sendPacket(new SM_RECIPE_LIST(player.getRecipeList().getRecipeList()));
+         client.sendPacket(new SM_QUEST_LIST(player));
+         client.sendPacket(new SM_RECIPE_LIST(player.getRecipeList().getRecipeList()));
 
          /*
           * Needed
           */
-         sendPacket(new SM_ENTER_WORLD_CHECK());
+         client.sendPacket(new SM_ENTER_WORLD_CHECK());
 
          byte[] uiSettings = player.getPlayerSettings().getUiSettings();
          byte[] shortcuts = player.getPlayerSettings().getShortcuts();
 
          if(uiSettings != null)
-            sendPacket(new SM_UI_SETTINGS(uiSettings, 0));
+            client.sendPacket(new SM_UI_SETTINGS(uiSettings, 0));
 
          if(shortcuts != null)
-            sendPacket(new SM_UI_SETTINGS(shortcuts, 1));
+            client.sendPacket(new SM_UI_SETTINGS(shortcuts, 1));
 
          // Cubesize limit set in inventory.
          int cubeSize = player.getCubeSize();
@@ -167,7 +172,7 @@
          List<Item> equipedItems = player.getEquipment().getEquippedItems();
          if(equipedItems.size() != 0)
          {
-            sendPacket(new SM_INVENTORY_INFO(player.getEquipment().getEquippedItems(), cubeSize));
+            client.sendPacket(new SM_INVENTORY_INFO(player.getEquipment().getEquippedItems(), cubeSize));
          }
 
          List<Item> unequipedItems = inventory.getAllItems();
@@ -178,19 +183,19 @@
             int index = 0;
             while(index + 10 < itemsSize)
             {
-               sendPacket(new SM_INVENTORY_INFO(unequipedItems.subList(index, index + 10), cubeSize));
+               client.sendPacket(new SM_INVENTORY_INFO(unequipedItems.subList(index, index + 10), cubeSize));
                index += 10;
             }
-            sendPacket(new SM_INVENTORY_INFO(unequipedItems.subList(index, itemsSize), cubeSize));
+            client.sendPacket(new SM_INVENTORY_INFO(unequipedItems.subList(index, itemsSize), cubeSize));
          }
 
-         sendPacket(new SM_INVENTORY_INFO());
+         client.sendPacket(new SM_INVENTORY_INFO());
 
          PlayerService.playerLoggedIn(player);
          
-         sendPacket(new SM_STATS_INFO(player));
+         client.sendPacket(new SM_STATS_INFO(player));
          
-         sendPacket(new SM_CUBE_UPDATE(player, 6, player.getCommonData().getAdvencedStigmaSlotSize()));
+         client.sendPacket(new SM_CUBE_UPDATE(player, 6, player.getCommonData().getAdvencedStigmaSlotSize()));
          
          KiskService.onLogin(player);
          TeleportService.sendSetBindPoint(player);
@@ -199,21 +204,21 @@
          if(player.isInAlliance())
             AllianceService.getInstance().onLogin(player);
          
-         sendPacket(new SM_PLAYER_ID(player));
+         client.sendPacket(new SM_PLAYER_ID(player));
          
-         sendPacket(new SM_MACRO_LIST(player));
-         sendPacket(new SM_GAME_TIME());
+         client.sendPacket(new SM_MACRO_LIST(player));
+         client.sendPacket(new SM_GAME_TIME());
          player.getController().updateNearbyQuests();
 
-         sendPacket(new SM_TITLE_LIST(player));      
-         sendPacket(new SM_CHANNEL_INFO(player.getPosition()));
-         sendPacket(new SM_PLAYER_SPAWN(player));
-         sendPacket(new SM_EMOTION_LIST());
-         sendPacket(new SM_INFLUENCE_RATIO());
-         sendPacket(new SM_SIEGE_LOCATION_INFO());
+         client.sendPacket(new SM_TITLE_LIST(player));      
+         client.sendPacket(new SM_CHANNEL_INFO(player.getPosition()));
+         client.sendPacket(new SM_PLAYER_SPAWN(player));
+         client.sendPacket(new SM_EMOTION_LIST());
+         client.sendPacket(new SM_INFLUENCE_RATIO());
+         client.sendPacket(new SM_SIEGE_LOCATION_INFO());
          // TODO: Send Rift Announce Here
-         sendPacket(new SM_PRICES(player.getPrices()));
-         sendPacket(new SM_ABYSS_RANK(player.getAbyssRank()));
+         client.sendPacket(new SM_PRICES(player.getPrices()));
+         client.sendPacket(new SM_ABYSS_RANK(player.getAbyssRank()));
 
          for(String message : getWelcomeMessage())
             PacketSendUtility.sendMessage(player, message);
@@ -265,7 +270,7 @@
       }
    }
 
-   private String[] getWelcomeMessage()
+   private static String[] getWelcomeMessage()
    {
       return new String[] {
             "Welcome to " + GSConfig.SERVER_NAME + ", powered by Aion Lightning revision " + VersionningService.getGameRevision(),
Index: src/main/java/com/aionemu/gameserver/network/aion/serverpackets/SM_QUIT_RESPONSE.java
===================================================================
--- src/main/java/com/aionemu/gameserver/network/aion/serverpackets/SM_QUIT_RESPONSE.java   (revision 288)
+++ src/main/java/com/aionemu/gameserver/network/aion/serverpackets/SM_QUIT_RESPONSE.java   (working copy)
@@ -29,13 +29,22 @@
  */
 public class SM_QUIT_RESPONSE extends AionServerPacket
 {
+   private boolean edit_mode = false;
+   
+   public SM_QUIT_RESPONSE(){}
+   
+   public SM_QUIT_RESPONSE(boolean edit_mode)
+   {
+      this.edit_mode = edit_mode;
+   }   
+   
    /**
     * {@inheritDoc}
     */
    @Override
    protected void writeImpl(AionConnection con, ByteBuffer buf)
    {
-      writeD(buf, 0x01);// unk
+      writeD(buf, edit_mode ? 2 : 1);//1 normal, 2 plastic surgery/gender switch
       writeC(buf, 0x00);// unk
    }
 }
Index: src/main/java/com/aionemu/gameserver/network/aion/clientpackets/CM_QUIT.java
===================================================================
--- src/main/java/com/aionemu/gameserver/network/aion/clientpackets/CM_QUIT.java   (revision 288)
+++ src/main/java/com/aionemu/gameserver/network/aion/clientpackets/CM_QUIT.java   (working copy)
@@ -64,9 +64,10 @@
    {
       AionConnection client = getConnection();
 
+      Player player = null;
       if(client.getState() == State.IN_GAME)
       {
-         Player player = client.getActivePlayer();
+         player = client.getActivePlayer();
          // TODO! check if may quit
          if(!logout)
             LoginServer.getInstance().aionClientDisconnected(client.getAccount().getId());
@@ -81,7 +82,13 @@
 
       if(logout)
       {
-         sendPacket(new SM_QUIT_RESPONSE());
+         if (player != null && player.isInEditMode())
+         {
+                sendPacket(new SM_QUIT_RESPONSE(true));
+                player.setEditMode(false);
+         }
+         else
+            sendPacket(new SM_QUIT_RESPONSE());
       }
       else
       {
Index: src/main/java/com/aionemu/gameserver/network/aion/serverpackets/SM_PLASTIC_SURGERY.java
===================================================================
--- src/main/java/com/aionemu/gameserver/network/aion/serverpackets/SM_PLASTIC_SURGERY.java   (revision 0)
+++ src/main/java/com/aionemu/gameserver/network/aion/serverpackets/SM_PLASTIC_SURGERY.java   (revision 0)
@@ -0,0 +1,33 @@
+package com.aionemu.gameserver.network.aion.serverpackets;
+
+import java.nio.ByteBuffer;
+
+import com.aionemu.gameserver.model.gameobjects.player.Player;
+import com.aionemu.gameserver.network.aion.AionConnection;
+import com.aionemu.gameserver.network.aion.AionServerPacket;
+
+/**
+ * @author IlBuono
+ */
+public class SM_PLASTIC_SURGERY extends AionServerPacket
+{
+   private int      playerObjId;
+    private byte    check_ticket;
+    private byte    change_sex;
+
+   public SM_PLASTIC_SURGERY(Player player, byte check_ticket, byte change_sex)
+   {
+            this.playerObjId = player.getObjectId();
+            this.check_ticket = check_ticket;
+            this.change_sex = change_sex;
+   }
+
+
+   @Override
+   protected void writeImpl(AionConnection con, ByteBuffer buf)
+   {
+            writeD(buf, playerObjId);
+            writeC(buf, check_ticket);
+            writeC(buf, change_sex);
+   }
+}
\ No newline at end of file
Index: src/main/java/com/aionemu/gameserver/network/factories/AionPacketHandlerFactory.java
===================================================================
--- src/main/java/com/aionemu/gameserver/network/factories/AionPacketHandlerFactory.java   (revision 288)
+++ src/main/java/com/aionemu/gameserver/network/factories/AionPacketHandlerFactory.java   (working copy)
@@ -158,6 +158,7 @@
       addPacket(new CM_OBJECT_SEARCH(0xF6), State.IN_GAME);// 1.9
       addPacket(new CM_CUSTOM_SETTINGS(0xF7), State.IN_GAME);// 1.9
       addPacket(new CM_REVIVE(0xF8), State.IN_GAME);// 1.9
+      addPacket(new CM_CHARACTER_EDIT(0xFA), State.AUTHED);// 1.9
       addPacket(new CM_ENTER_WORLD(0xFB), State.AUTHED); // 1.9
       addPacket(new CM_TIME_CHECK(0xFD), State.CONNECTED, State.AUTHED, State.IN_GAME);// 1.9
       addPacket(new CM_GATHER(0xFE), State.IN_GAME);// 1.9
Index: src/main/java/com/aionemu/gameserver/model/gameobjects/player/Player.java
===================================================================
--- src/main/java/com/aionemu/gameserver/model/gameobjects/player/Player.java   (revision 288)
+++ src/main/java/com/aionemu/gameserver/model/gameobjects/player/Player.java   (working copy)
@@ -119,7 +119,7 @@
    private Kisk            kisk;
    private Prices             prices;
    private boolean            isGagged      = false;
-
+   private boolean            edit_mode       = false;
    private Map<Integer, ItemCooldown>   itemCoolDowns;
    
    /**
@@ -1329,4 +1329,20 @@
    {
       return (this.playerAlliance != null);
    }
+   
+   /**
+    * @author IlBuono
+   */
+   public void setEditMode(boolean edit_mode)
+   {
+      this.edit_mode = edit_mode;
+   }
+   
+   /**
+    * @author IlBuono
+   */
+   public boolean isInEditMode()
+   {
+      return edit_mode;
+   }
 }
Index: src/main/java/com/aionemu/gameserver/controllers/NpcController.java
===================================================================
--- src/main/java/com/aionemu/gameserver/controllers/NpcController.java   (revision 288)
+++ src/main/java/com/aionemu/gameserver/controllers/NpcController.java   (working copy)
@@ -45,6 +45,7 @@
 import com.aionemu.gameserver.network.aion.serverpackets.SM_EMOTION;
 import com.aionemu.gameserver.network.aion.serverpackets.SM_LOOKATOBJECT;
 import com.aionemu.gameserver.network.aion.serverpackets.SM_MESSAGE;
+import com.aionemu.gameserver.network.aion.serverpackets.SM_PLASTIC_SURGERY;
 import com.aionemu.gameserver.network.aion.serverpackets.SM_QUESTION_WINDOW;
 import com.aionemu.gameserver.network.aion.serverpackets.SM_SELL_ITEM;
 import com.aionemu.gameserver.network.aion.serverpackets.SM_SYSTEM_MESSAGE;
@@ -394,6 +395,29 @@
             PacketSendUtility.sendPacket(player, new SM_MESSAGE(0, null, "This feature is not available yet",
                ChatType.ANNOUNCEMENTS));
             break;
+         case 55:
+         case 56:
+               /**
+               * @author IlBuono
+               */
+               byte changesex = 0; //0 plastic surgery, 1 gender switch
+               byte check_ticket = 2; // 2 no ticket, 1 have ticket
+               if (dialogId == 56)
+               {
+                  //Gender Switch
+                   changesex = 1;
+                   if (player.getInventory().getItemCountByItemId(169660000) > 0 || player.getInventory().getItemCountByItemId(169660001) > 0)
+                       check_ticket = 1;
+               }
+               else
+               {
+                  //Plastic Surgery
+                   if (player.getInventory().getItemCountByItemId(169650000) > 0 || player.getInventory().getItemCountByItemId(169650001) > 0)
+                       check_ticket = 1;
+               }
+               PacketSendUtility.sendPacket(player, new SM_PLASTIC_SURGERY(player,check_ticket, changesex));
+               player.setEditMode(true);
+               break;
          case 60:
             // armsfusion
             PacketSendUtility.sendPacket(player, new SM_DIALOG_WINDOW(targetObjectId, 29));
Index: src/main/java/com/aionemu/gameserver/network/aion/clientpackets/CM_CHARACTER_EDIT.java
===================================================================
--- src/main/java/com/aionemu/gameserver/network/aion/clientpackets/CM_CHARACTER_EDIT.java   (revision 0)
+++ src/main/java/com/aionemu/gameserver/network/aion/clientpackets/CM_CHARACTER_EDIT.java   (revision 0)
@@ -0,0 +1,200 @@
+/*
+ * This file is part of aion-emu <aion-emu.com>.
+ *
+ *  aion-emu is free software: you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation, either version 3 of the License, or
+ *  (at your option) any later version.
+ *
+ *  aion-emu is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with aion-emu.  If not, see <http://www.gnu.org/licenses/>.
+ */
+package com.aionemu.gameserver.network.aion.clientpackets;
+
+import com.aionemu.commons.database.dao.DAOManager;
+import com.aionemu.gameserver.dao.PlayerAppearanceDAO;
+import com.aionemu.gameserver.dao.PlayerDAO;
+import com.aionemu.gameserver.model.Gender;
+import com.aionemu.gameserver.model.account.Account;
+import com.aionemu.gameserver.model.gameobjects.player.Player;
+import com.aionemu.gameserver.model.gameobjects.player.PlayerAppearance;
+import com.aionemu.gameserver.model.gameobjects.player.PlayerCommonData;
+import com.aionemu.gameserver.network.aion.AionClientPacket;
+import com.aionemu.gameserver.network.aion.AionConnection;
+import com.aionemu.gameserver.services.ItemService;
+import com.aionemu.gameserver.services.PlayerService;
+import com.aionemu.gameserver.utils.PacketSendUtility;
+
+/**
+ * In this packets aion client is requesting edit of character.
+ *
+ * @author IlBuono
+ *
+ */
+public class CM_CHARACTER_EDIT extends AionClientPacket
+{   
+   
+    private int objectId;
+
+    private boolean gender_change;
+
+    private boolean check_ticket = true;
+
+   /**
+    * Constructs new instance of <tt>CM_CREATE_CHARACTER </tt> packet
+    *
+    * @param opcode
+    */
+   public CM_CHARACTER_EDIT(int opcode)
+   {
+      super(opcode);
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   @Override
+   protected void readImpl()
+   {
+        AionConnection client = getConnection();
+      Account account = client.getAccount();
+        objectId = readD();
+        Player player = PlayerService.getPlayer(objectId, account);
+        readB(44);
+        PlayerCommonData playerCommonData = player.getCommonData();
+        PlayerAppearance playerAppearance = player.getPlayerAppearance();
+        //Before modify appearance, we do a check of ticket
+        int gender = readD();
+        gender_change = playerCommonData.getGender().getGenderId() == gender ? false : true;
+        if(!gender_change)
+        {
+            if (player.getInventory().getItemCountByItemId(169650000) == 0 && player.getInventory().getItemCountByItemId(169650001) == 0)
+            {
+                check_ticket = false;
+                return;
+            }
+        }
+        else
+        {
+            if (player.getInventory().getItemCountByItemId(169660000) == 0 && player.getInventory().getItemCountByItemId(169660001) == 0)
+            {
+                check_ticket = false;
+                return;
+            }
+        }
+        playerCommonData.setGender(gender == 0 ? Gender.MALE : Gender.FEMALE);
+      readD(); //race
+      readD(); //player class
+
+      playerAppearance.setVoice(readD());
+      playerAppearance.setSkinRGB(readD());
+      playerAppearance.setHairRGB(readD());
+      playerAppearance.setEyeRGB(readD());
+      playerAppearance.setLipRGB(readD());
+      playerAppearance.setFace(readC());
+      playerAppearance.setHair(readC());
+      playerAppearance.setDeco(readC());
+      playerAppearance.setTattoo(readC());
+
+      readC(); // always 4 o0 // 5 in 1.5.x
+
+      playerAppearance.setFaceShape(readC());
+      playerAppearance.setForehead(readC());
+
+      playerAppearance.setEyeHeight(readC());
+      playerAppearance.setEyeSpace(readC());
+      playerAppearance.setEyeWidth(readC());
+      playerAppearance.setEyeSize(readC());
+      playerAppearance.setEyeShape(readC());
+      playerAppearance.setEyeAngle(readC());
+
+      playerAppearance.setBrowHeight(readC());
+      playerAppearance.setBrowAngle(readC());
+      playerAppearance.setBrowShape(readC());
+
+      playerAppearance.setNose(readC());
+      playerAppearance.setNoseBridge(readC());
+      playerAppearance.setNoseWidth(readC());
+      playerAppearance.setNoseTip(readC());
+
+      playerAppearance.setCheek(readC());
+      playerAppearance.setLipHeight(readC());
+      playerAppearance.setMouthSize(readC());
+      playerAppearance.setLipSize(readC());
+      playerAppearance.setSmile(readC());
+      playerAppearance.setLipShape(readC());
+      playerAppearance.setJawHeigh(readC());
+      playerAppearance.setChinJut(readC());
+      playerAppearance.setEarShape(readC());
+      playerAppearance.setHeadSize(readC());
+
+      playerAppearance.setNeck(readC());
+      playerAppearance.setNeckLength(readC());
+
+      playerAppearance.setShoulderSize(readC());
+
+      playerAppearance.setTorso(readC());
+      playerAppearance.setChest(readC()); // only woman
+      playerAppearance.setWaist(readC());
+
+      playerAppearance.setHips(readC());
+      playerAppearance.setArmThickness(readC());
+
+      playerAppearance.setHandSize(readC());
+      playerAppearance.setLegThicnkess(readC());
+
+      playerAppearance.setFootSize(readC());
+      playerAppearance.setFacialRate(readC());
+
+      readC(); // always 0
+      playerAppearance.setArmLength(readC());
+      playerAppearance.setLegLength(readC()); //wrong??
+      playerAppearance.setShoulders(readC()); // 1.5.x May be ShoulderSize
+      readC(); // always 0
+      readC();
+      playerAppearance.setHeight(readF());
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   @Override
+   protected void runImpl()
+   {
+      AionConnection client = getConnection();      
+      CM_ENTER_WORLD.enterWorld(client, objectId);
+      Player player = client.getActivePlayer();
+        if (!check_ticket)
+        {
+            if (!gender_change)
+                PacketSendUtility.sendSysMessage(player, "You must have a Plastic Surgery Ticket!");
+            else
+                PacketSendUtility.sendSysMessage(player, "You must have a Gender Switch Ticket!");
+        }
+        else
+        {
+           //Remove ticket and save appearance
+           if(!gender_change)
+            {
+                if (player.getInventory().getItemCountByItemId(169650000) > 0) //plastic surgery ticket normal
+                    ItemService.decreaseItemCountByItemId(player,169650000,1);
+                else if (player.getInventory().getItemCountByItemId(169650001) > 0) //plastic surgery ticket event
+                   ItemService.decreaseItemCountByItemId(player,169650001, 1);
+            }
+            else
+            {
+                if (player.getInventory().getItemCountByItemId(169660000) > 0) //gender switch ticket normal
+                   ItemService.decreaseItemCountByItemId(player,169660000, 1);
+                else if (player.getInventory().getItemCountByItemId(169660001) > 0) //gender switch ticket event
+                   ItemService.decreaseItemCountByItemId(player,169660001, 1);
+                DAOManager.getDAO(PlayerDAO.class).storePlayer(player); //save new gender
+            }
+           DAOManager.getDAO(PlayerAppearanceDAO.class).store(player);   //save new appearance
+        }
+   }
+}
\ No newline at end of file
M@xx
M@xx
Core dev
Core dev

Messages : 83
Date d'inscription : 2010-07-30

https://aiongates.forums-actifs.com

Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum