Hallo,
habe das Sash System with Scale verbaut, nach einigen Stunden erfolgloser Fehlersuche habe ich feststellen können das der ItemSubType nicht auf 3 sondern 2 liegt.
Nun funktioniert das Kombinieren und die Boni übernahme. Das anziehen der Sash's ist aber dennoch nicht möglich.
Hab keine Ahnung an was es liegen könnte, syserr's sind leer. Das einzige Problem welches ich seitdem noch habe ist das sich die Effekte für die Auto-Potts über alle Inventarseiten legen.
Bitte melden Sie sich an, um diesen Link zu sehen.
Ein paar Files, wenn Ihr noch etwas braucht kann ich es posten.
Client side
ItemData.h
- #pragma once
- #define ENABLE_CHANGE_LOOK_SYSTEM
- // NOTE : ItemÀÇ ÅëÇÕ °ü¸® Ŭ·¡½º´Ù.
- // Icon, Model (droped on ground), Game Data
- #include "../eterLib/GrpSubImage.h"
- #include "../eterGrnLib/Thing.h"
- #include "../UserInterface/Locale_inc.h"
- class CItemData
- {
- public:
- enum
- {
- ITEM_NAME_MAX_LEN = 24,
- ITEM_LIMIT_MAX_NUM = 2,
- ITEM_VALUES_MAX_NUM = 6,
- ITEM_SMALL_DESCR_MAX_LEN = 256,
- ITEM_APPLY_MAX_NUM = 3,
- ITEM_SOCKET_MAX_NUM = 3,
- };
- enum EItemType
- {
- ITEM_TYPE_NONE, //0
- ITEM_TYPE_WEAPON, //1//¹«±â
- ITEM_TYPE_ARMOR, //2//°©¿Ê
- ITEM_TYPE_USE, //3//¾ÆÀÌÅÛ »ç¿ë
- ITEM_TYPE_AUTOUSE, //4
- ITEM_TYPE_MATERIAL, //5
- ITEM_TYPE_SPECIAL, //6 //½ºÆä¼È ¾ÆÀÌÅÛ
- ITEM_TYPE_TOOL, //7
- ITEM_TYPE_LOTTERY, //8//º¹±Ç
- ITEM_TYPE_ELK, //9//µ·
- ITEM_TYPE_METIN, //10
- ITEM_TYPE_CONTAINER, //11
- ITEM_TYPE_FISH, //12//³¬½Ã
- ITEM_TYPE_ROD, //13
- ITEM_TYPE_RESOURCE, //14
- ITEM_TYPE_CAMPFIRE, //15
- ITEM_TYPE_UNIQUE, //16
- ITEM_TYPE_SKILLBOOK, //17
- ITEM_TYPE_QUEST, //18
- ITEM_TYPE_POLYMORPH, //19
- ITEM_TYPE_TREASURE_BOX, //20//º¸¹°»óÀÚ
- ITEM_TYPE_TREASURE_KEY, //21//º¸¹°»óÀÚ ¿¼è
- ITEM_TYPE_SKILLFORGET, //22
- ITEM_TYPE_GIFTBOX, //23
- ITEM_TYPE_PICK, //24
- ITEM_TYPE_HAIR, //25//¸Ó¸®
- ITEM_TYPE_TOTEM, //26//ÅäÅÛ
- ITEM_TYPE_BLEND, //27//»ý¼ºµÉ¶§ ·£´ýÇÏ°Ô ¼Ó¼ºÀÌ ºÙ´Â ¾à¹°
- ITEM_TYPE_COSTUME, //28//ÄÚ½ºÃõ ¾ÆÀÌÅÛ (2011³â 8¿ù Ãß°¡µÈ ÄÚ½ºÃõ ½Ã½ºÅÛ¿ë ¾ÆÀÌÅÛ)
- ITEM_TYPE_DS, //29 //¿ëÈ¥¼®
- ITEM_TYPE_SPECIAL_DS, //30 // Ư¼öÇÑ ¿ëÈ¥¼® (DS_SLOT¿¡ Âø¿ëÇÏ´Â UNIQUE ¾ÆÀÌÅÛÀ̶ó »ý°¢ÇÏ¸é µÊ)
- ITEM_TYPE_EXTRACT, //31 ÃßÃâµµ±¸.
- ITEM_TYPE_SECONDARY_COIN, //32 ¸íµµÀü.
- ITEM_TYPE_RING, //33 ¹ÝÁö (À¯´ÏÅ© ½½·ÔÀÌ ¾Æ´Ñ ¼ø¼ö ¹ÝÁö ½½·Ô)
- ITEM_TYPE_BELT, //34 º§Æ®
- #ifdef ENABLE_SHINING_SYSTEM
- ITEM_TYPE_SHINING, //35
- #endif
- ITEM_TYPE_MAX_NUM,
- };
- enum EWeaponSubTypes
- {
- WEAPON_SWORD,
- WEAPON_DAGGER, //À̵µ·ù
- WEAPON_BOW,
- WEAPON_TWO_HANDED,
- WEAPON_BELL,
- WEAPON_FAN,
- WEAPON_ARROW,
- WEAPON_NUM_TYPES,
- WEAPON_NONE = WEAPON_NUM_TYPES+1,
- };
- enum EMaterialSubTypes
- {
- MATERIAL_LEATHER,
- MATERIAL_BLOOD,
- MATERIAL_ROOT,
- MATERIAL_NEEDLE,
- MATERIAL_JEWEL,
- MATERIAL_DS_REFINE_NORMAL,
- MATERIAL_DS_REFINE_BLESSED,
- MATERIAL_DS_REFINE_HOLLY,
- };
- enum EArmorSubTypes
- {
- ARMOR_BODY,
- ARMOR_HEAD,
- ARMOR_SHIELD,
- ARMOR_WRIST,
- ARMOR_FOOTS,
- ARMOR_NECK,
- ARMOR_EAR,
- ARMOR_NUM_TYPES
- };
- enum ECostumeSubTypes
- {
- COSTUME_BODY, //0 °©¿Ê(main look)
- COSTUME_HAIR, //1 Çì¾î(Å»Âø°¡´É)
- #ifdef ENABLE_SASH_SYSTEM
- COSTUME_SASH,
- #endif
- COSTUME_NUM_TYPES,
- };
- enum EUseSubTypes
- {
- USE_POTION, // 0
- USE_TALISMAN,
- USE_TUNING,
- USE_MOVE,
- USE_TREASURE_BOX,
- USE_MONEYBAG,
- USE_BAIT,
- USE_ABILITY_UP,
- USE_AFFECT,
- USE_CREATE_STONE,
- USE_SPECIAL, // 10
- USE_POTION_NODELAY,
- USE_CLEAR,
- USE_INVISIBILITY,
- USE_DETACHMENT,
- USE_BUCKET,
- USE_POTION_CONTINUE,
- USE_CLEAN_SOCKET,
- USE_CHANGE_ATTRIBUTE,
- USE_ADD_ATTRIBUTE,
- USE_ADD_ACCESSORY_SOCKET, // 20
- USE_PUT_INTO_ACCESSORY_SOCKET,
- USE_ADD_ATTRIBUTE2,
- USE_RECIPE,
- USE_CHANGE_ATTRIBUTE2,
- USE_BIND,
- USE_UNBIND,
- USE_TIME_CHARGE_PER,
- USE_TIME_CHARGE_FIX, // 28
- USE_PUT_INTO_BELT_SOCKET, // 29 º§Æ® ¼ÒÄÏ¿¡ »ç¿ëÇÒ ¼ö ÀÖ´Â ¾ÆÀÌÅÛ
- USE_PUT_INTO_RING_SOCKET, // 30 ¹ÝÁö ¼ÒÄÏ¿¡ »ç¿ëÇÒ ¼ö ÀÖ´Â ¾ÆÀÌÅÛ (À¯´ÏÅ© ¹ÝÁö ¸»°í, »õ·Î Ãß°¡µÈ ¹ÝÁö ½½·Ô)
- #ifdef ENABLE_CHANGE_LOOK_SYSTEM
- USE_RESET_LOOK_VNUM,
- #endif
- };
- enum EDragonSoulSubType
- {
- DS_SLOT1,
- DS_SLOT2,
- DS_SLOT3,
- DS_SLOT4,
- DS_SLOT5,
- DS_SLOT6,
- DS_SLOT_NUM_TYPES = 6,
- };
- enum EMetinSubTypes
- {
- METIN_NORMAL,
- METIN_GOLD,
- };
- #ifdef ENABLE_SHINING_SYSTEM
- enum EShiningSubTypes
- {
- SHINING_WEAPON,
- SHINING_ARMOR,
- SHINING_SPECIAL, //Special like GM Logo or somethings
- };
- #endif
- enum ELimitTypes
- {
- LIMIT_NONE,
- LIMIT_LEVEL,
- LIMIT_STR,
- LIMIT_DEX,
- LIMIT_INT,
- LIMIT_CON,
- LIMIT_PCBANG,
- /// Âø¿ë ¿©ºÎ¿Í »ó°ü ¾øÀÌ ½Ç½Ã°£À¸·Î ½Ã°£ Â÷°¨ (socket0¿¡ ¼Ò¸ê ½Ã°£ÀÌ ¹ÚÈû: unix_timestamp ŸÀÔ)
- LIMIT_REAL_TIME,
- /// ¾ÆÀÌÅÛÀ» ¸Ç óÀ½ »ç¿ë(ȤÀº Âø¿ë) ÇÑ ¼ø°£ºÎÅÍ ¸®¾óŸÀÓ Å¸ÀÌ¸Ó ½ÃÀÛ
- /// ÃÖÃÊ »ç¿ë Àü¿¡´Â socket0¿¡ »ç¿ë°¡´É½Ã°£(ÃÊ´ÜÀ§, 0À̸é ÇÁ·ÎÅäÀÇ limit value°ª »ç¿ë) °ªÀÌ ¾²¿©ÀÖ´Ù°¡
- /// ¾ÆÀÌÅÛ »ç¿ë½Ã socket1¿¡ »ç¿ë Ƚ¼ö°¡ ¹ÚÈ÷°í socket0¿¡ unix_timestamp ŸÀÔÀÇ ¼Ò¸ê½Ã°£ÀÌ ¹ÚÈû.
- LIMIT_REAL_TIME_START_FIRST_USE,
- /// ¾ÆÀÌÅÛÀ» Âø¿ë ÁßÀÏ ¶§¸¸ »ç¿ë ½Ã°£ÀÌ Â÷°¨µÇ´Â ¾ÆÀÌÅÛ
- /// socket0¿¡ ³²Àº ½Ã°£ÀÌ ÃÊ´ÜÀ§·Î ¹ÚÈû. (¾ÆÀÌÅÛ ÃÖÃÊ »ç¿ë½Ã ÇØ´ç °ªÀÌ 0À̸é ÇÁ·ÎÅäÀÇ limit value°ªÀ» socket0¿¡ º¹»ç)
- LIMIT_TIMER_BASED_ON_WEAR,
- LIMIT_MAX_NUM
- };
- enum EItemAntiFlag
- {
- ITEM_ANTIFLAG_FEMALE = (1 << 0), // ¿©¼º »ç¿ë ºÒ°¡
- ITEM_ANTIFLAG_MALE = (1 << 1), // ³²¼º »ç¿ë ºÒ°¡
- ITEM_ANTIFLAG_WARRIOR = (1 << 2), // ¹«»ç »ç¿ë ºÒ°¡
- ITEM_ANTIFLAG_ASSASSIN = (1 << 3), // ÀÚ°´ »ç¿ë ºÒ°¡
- ITEM_ANTIFLAG_SURA = (1 << 4), // ¼ö¶ó »ç¿ë ºÒ°¡
- ITEM_ANTIFLAG_SHAMAN = (1 << 5), // ¹«´ç »ç¿ë ºÒ°¡
- ITEM_ANTIFLAG_GET = (1 << 6), // ÁýÀ» ¼ö ¾øÀ½
- ITEM_ANTIFLAG_DROP = (1 << 7), // ¹ö¸± ¼ö ¾øÀ½
- ITEM_ANTIFLAG_SELL = (1 << 8), // ÆÈ ¼ö ¾øÀ½
- ITEM_ANTIFLAG_EMPIRE_A = (1 << 9), // A Á¦±¹ »ç¿ë ºÒ°¡
- ITEM_ANTIFLAG_EMPIRE_B = (1 << 10), // B Á¦±¹ »ç¿ë ºÒ°¡
- ITEM_ANTIFLAG_EMPIRE_R = (1 << 11), // C Á¦±¹ »ç¿ë ºÒ°¡
- ITEM_ANTIFLAG_SAVE = (1 << 12), // ÀúÀåµÇÁö ¾ÊÀ½
- ITEM_ANTIFLAG_GIVE = (1 << 13), // °Å·¡ ºÒ°¡
- ITEM_ANTIFLAG_PKDROP = (1 << 14), // PK½Ã ¶³¾îÁöÁö ¾ÊÀ½
- ITEM_ANTIFLAG_STACK = (1 << 15), // ÇÕÄ¥ ¼ö ¾øÀ½
- ITEM_ANTIFLAG_MYSHOP = (1 << 16), // °³ÀÎ »óÁ¡¿¡ ¿Ã¸± ¼ö ¾øÀ½
- };
- enum EItemFlag
- {
- ITEM_FLAG_REFINEABLE = (1 << 0), // °³·® °¡´É
- ITEM_FLAG_SAVE = (1 << 1),
- ITEM_FLAG_STACKABLE = (1 << 2), // ¿©·¯°³ ÇÕÄ¥ ¼ö ÀÖÀ½
- ITEM_FLAG_COUNT_PER_1GOLD = (1 << 3), // °¡°ÝÀÌ °³¼ö / °¡°ÝÀ¸·Î º¯ÇÔ
- ITEM_FLAG_SLOW_QUERY = (1 << 4), // °ÔÀÓ Á¾·á½Ã¿¡¸¸ SQL¿¡ Äõ¸®ÇÔ
- ITEM_FLAG_RARE = (1 << 5),
- ITEM_FLAG_UNIQUE = (1 << 6),
- ITEM_FLAG_MAKECOUNT = (1 << 7),
- ITEM_FLAG_IRREMOVABLE = (1 << 8),
- ITEM_FLAG_CONFIRM_WHEN_USE = (1 << 9),
- ITEM_FLAG_QUEST_USE = (1 << 10), // Äù½ºÆ® ½ºÅ©¸³Æ® µ¹¸®´ÂÁö?
- ITEM_FLAG_QUEST_USE_MULTIPLE= (1 << 11), // Äù½ºÆ® ½ºÅ©¸³Æ® µ¹¸®´ÂÁö?
- ITEM_FLAG_UNUSED03 = (1 << 12), // UNUSED03
- ITEM_FLAG_LOG = (1 << 13), // »ç¿ë½Ã ·Î±×¸¦ ³²±â´Â ¾ÆÀÌÅÛÀΰ¡?
- ITEM_FLAG_APPLICABLE = (1 << 14),
- };
- enum EWearPositions
- {
- WEAR_BODY, // 0
- WEAR_HEAD, // 1
- WEAR_FOOTS, // 2
- WEAR_WRIST, // 3
- WEAR_WEAPON, // 4
- WEAR_NECK, // 5
- WEAR_EAR, // 6
- WEAR_UNIQUE1, // 7
- WEAR_UNIQUE2, // 8
- WEAR_ARROW, // 9
- WEAR_SHIELD, // 10
- #ifdef ENABLE_SASH_SYSTEM
- WEAR_COSTUME_SASH = 32,
- #endif
- WEAR_MAX_NUM,
- };
- enum EItemWearableFlag
- {
- WEARABLE_BODY = (1 << 0),
- WEARABLE_HEAD = (1 << 1),
- WEARABLE_FOOTS = (1 << 2),
- WEARABLE_WRIST = (1 << 3),
- WEARABLE_WEAPON = (1 << 4),
- WEARABLE_NECK = (1 << 5),
- WEARABLE_EAR = (1 << 6),
- WEARABLE_UNIQUE = (1 << 7),
- WEARABLE_SHIELD = (1 << 8),
- WEARABLE_ARROW = (1 << 9),
- };
- enum EApplyTypes
- {
- APPLY_NONE, // 0
- APPLY_MAX_HP, // 1
- APPLY_MAX_SP, // 2
- APPLY_CON, // 3
- APPLY_INT, // 4
- APPLY_STR, // 5
- APPLY_DEX, // 6
- APPLY_ATT_SPEED, // 7
- APPLY_MOV_SPEED, // 8
- APPLY_CAST_SPEED, // 9
- APPLY_HP_REGEN, // 10
- APPLY_SP_REGEN, // 11
- APPLY_POISON_PCT, // 12
- APPLY_STUN_PCT, // 13
- APPLY_SLOW_PCT, // 14
- APPLY_CRITICAL_PCT, // 15
- APPLY_PENETRATE_PCT, // 16
- APPLY_ATTBONUS_HUMAN, // 17
- APPLY_ATTBONUS_ANIMAL, // 18
- APPLY_ATTBONUS_ORC, // 19
- APPLY_ATTBONUS_MILGYO, // 20
- APPLY_ATTBONUS_UNDEAD, // 21
- APPLY_ATTBONUS_DEVIL, // 22
- APPLY_STEAL_HP, // 23
- APPLY_STEAL_SP, // 24
- APPLY_MANA_BURN_PCT, // 25
- APPLY_DAMAGE_SP_RECOVER, // 26
- APPLY_BLOCK, // 27
- APPLY_DODGE, // 28
- APPLY_RESIST_SWORD, // 29
- APPLY_RESIST_TWOHAND, // 30
- APPLY_RESIST_DAGGER, // 31
- APPLY_RESIST_BELL, // 32
- APPLY_RESIST_FAN, // 33
- APPLY_RESIST_BOW, // 34
- APPLY_RESIST_FIRE, // 35
- APPLY_RESIST_ELEC, // 36
- APPLY_RESIST_MAGIC, // 37
- APPLY_RESIST_WIND, // 38
- APPLY_REFLECT_MELEE, // 39
- APPLY_REFLECT_CURSE, // 40
- APPLY_POISON_REDUCE, // 41
- APPLY_KILL_SP_RECOVER, // 42
- APPLY_EXP_DOUBLE_BONUS, // 43
- APPLY_GOLD_DOUBLE_BONUS, // 44
- APPLY_ITEM_DROP_BONUS, // 45
- APPLY_POTION_BONUS, // 46
- APPLY_KILL_HP_RECOVER, // 47
- APPLY_IMMUNE_STUN, // 48
- APPLY_IMMUNE_SLOW, // 49
- APPLY_IMMUNE_FALL, // 50
- APPLY_SKILL, // 51
- APPLY_BOW_DISTANCE, // 52
- APPLY_ATT_GRADE_BONUS, // 53
- APPLY_DEF_GRADE_BONUS, // 54
- APPLY_MAGIC_ATT_GRADE, // 55
- APPLY_MAGIC_DEF_GRADE, // 56
- APPLY_CURSE_PCT, // 57
- APPLY_MAX_STAMINA, // 58
- APPLY_ATT_BONUS_TO_WARRIOR, // 59
- APPLY_ATT_BONUS_TO_ASSASSIN,// 60
- APPLY_ATT_BONUS_TO_SURA, // 61
- APPLY_ATT_BONUS_TO_SHAMAN, // 62
- APPLY_ATT_BONUS_TO_MONSTER, // 63
- APPLY_MALL_ATTBONUS, // 64 °ø°Ý·Â +x%
- APPLY_MALL_DEFBONUS, // 65 ¹æ¾î·Â +x%
- APPLY_MALL_EXPBONUS, // 66 °æÇèÄ¡ +x%
- APPLY_MALL_ITEMBONUS, // 67 ¾ÆÀÌÅÛ µå·ÓÀ² x/10¹è
- APPLY_MALL_GOLDBONUS, // 68 µ· µå·ÓÀ² x/10¹è
- APPLY_MAX_HP_PCT, // 69 ÃÖ´ë »ý¸í·Â +x%
- APPLY_MAX_SP_PCT, // 70 ÃÖ´ë Á¤½Å·Â +x%
- APPLY_SKILL_DAMAGE_BONUS, // 71 ½ºÅ³ µ¥¹ÌÁö * (100+x)%
- APPLY_NORMAL_HIT_DAMAGE_BONUS, // 72 ÆòŸ µ¥¹ÌÁö * (100+x)%
- APPLY_SKILL_DEFEND_BONUS, // 73 ½ºÅ³ µ¥¹ÌÁö ¹æ¾î * (100-x)%
- APPLY_NORMAL_HIT_DEFEND_BONUS, // 74 ÆòŸ µ¥¹ÌÁö ¹æ¾î * (100-x)%
- APPLY_EXTRACT_HP_PCT, //75
- APPLY_PC_BANG_EXP_BONUS, //76
- APPLY_PC_BANG_DROP_BONUS, //77
- APPLY_RESIST_WARRIOR, //78
- APPLY_RESIST_ASSASSIN , //79
- APPLY_RESIST_SURA, //80
- APPLY_RESIST_SHAMAN, //81
- APPLY_ENERGY, //82
- APPLY_DEF_GRADE, // 83 ¹æ¾î·Â. DEF_GRADE_BONUS´Â Ŭ¶ó¿¡¼ µÎ¹è·Î º¸¿©Áö´Â ÀǵµµÈ ¹ö±×(...)°¡ ÀÖ´Ù.
- APPLY_COSTUME_ATTR_BONUS, // 84 ÄÚ½ºÆ¬ ¾ÆÀÌÅÛ¿¡ ºÙÀº ¼Ó¼ºÄ¡ º¸³Ê½º
- APPLY_MAGIC_ATTBONUS_PER, // 85 ¸¶¹ý °ø°Ý·Â +x%
- APPLY_MELEE_MAGIC_ATTBONUS_PER, // 86 ¸¶¹ý + ¹Ð¸® °ø°Ý·Â +x%
- APPLY_RESIST_ICE, // 87 ³Ã±â ÀúÇ×
- APPLY_RESIST_EARTH, // 88 ´ëÁö ÀúÇ×
- APPLY_RESIST_DARK, // 89 ¾îµÒ ÀúÇ×
- APPLY_ANTI_CRITICAL_PCT, //90 Å©¸®Æ¼Äà ÀúÇ×
- APPLY_ANTI_PENETRATE_PCT, //91 °üÅëŸ°Ý ÀúÇ×
- MAX_APPLY_NUM, //
- };
- enum EImmuneFlags
- {
- IMMUNE_PARA = (1 << 0),
- IMMUNE_CURSE = (1 << 1),
- IMMUNE_STUN = (1 << 2),
- IMMUNE_SLEEP = (1 << 3),
- IMMUNE_SLOW = (1 << 4),
- IMMUNE_POISON = (1 << 5),
- IMMUNE_TERROR = (1 << 6),
- };
- #pragma pack(push)
- #pragma pack(1)
- typedef struct SItemLimit
- {
- BYTE bType;
- long lValue;
- } TItemLimit;
- typedef struct SItemApply
- {
- BYTE bType;
- long lValue;
- } TItemApply;
- typedef struct SItemTable
- {
- DWORD dwVnum;
- DWORD dwVnumRange;
- char szName[ITEM_NAME_MAX_LEN + 1];
- char szLocaleName[ITEM_NAME_MAX_LEN + 1];
- BYTE bType;
- BYTE bSubType;
- BYTE bWeight;
- BYTE bSize;
- DWORD dwAntiFlags;
- DWORD dwFlags;
- DWORD dwWearFlags;
- DWORD dwImmuneFlag;
- DWORD dwIBuyItemPrice;
- DWORD dwISellItemPrice;
- TItemLimit aLimits[ITEM_LIMIT_MAX_NUM];
- TItemApply aApplies[ITEM_APPLY_MAX_NUM];
- long alValues[ITEM_VALUES_MAX_NUM];
- long alSockets[ITEM_SOCKET_MAX_NUM];
- DWORD dwRefinedVnum;
- WORD wRefineSet;
- BYTE bAlterToMagicItemPct;
- BYTE bSpecular;
- BYTE bGainSocketPct;
- } TItemTable;
- #ifdef ENABLE_SASH_SYSTEM
- struct SScaleInfo
- {
- float fScaleX, fScaleY, fScaleZ;
- float fPositionX, fPositionY, fPositionZ;
- };
- typedef struct SScaleTable
- {
- SScaleInfo tInfo[10];
- } TScaleTable;
- #endif
- // typedef struct SItemTable
- // {
- // DWORD dwVnum;
- // char szItemName[ITEM_NAME_MAX_LEN + 1];
- // BYTE bType;
- // BYTE bSubType;
- // BYTE bSize;
- // DWORD dwAntiFlags;
- // DWORD dwFlags;
- // DWORD dwWearFlags;
- // DWORD dwIBuyItemPrice;
- // DWORD dwISellItemPrice;
- // TItemLimit aLimits[ITEM_LIMIT_MAX_NUM];
- // TItemApply aApplies[ITEM_APPLY_MAX_NUM];
- // long alValues[ITEM_VALUES_MAX_NUM];
- // long alSockets[ITEM_SOCKET_MAX_NUM];
- // DWORD dwRefinedVnum;
- // BYTE bSpecular;
- // DWORD dwIconNumber;
- // } TItemTable;
- #pragma pack(pop)
- public:
- CItemData();
- virtual ~CItemData();
- void Clear();
- void SetSummary(const std::string& c_rstSumm);
- void SetDescription(const std::string& c_rstDesc);
- CGraphicThing * GetModelThing();
- CGraphicThing * GetSubModelThing();
- CGraphicThing * GetDropModelThing();
- CGraphicSubImage * GetIconImage();
- DWORD GetLODModelThingCount();
- BOOL GetLODModelThingPointer(DWORD dwIndex, CGraphicThing ** ppModelThing);
- DWORD GetAttachingDataCount();
- BOOL GetCollisionDataPointer(DWORD dwIndex, const NRaceData::TAttachingData ** c_ppAttachingData);
- BOOL GetAttachingDataPointer(DWORD dwIndex, const NRaceData::TAttachingData ** c_ppAttachingData);
- /////
- const TItemTable* GetTable() const;
- DWORD GetIndex() const;
- const char * GetName() const;
- const char * GetDescription() const;
- const char * GetSummary() const;
- BYTE GetType() const;
- BYTE GetSubType() const;
- UINT GetRefine() const;
- const char* GetUseTypeString() const;
- DWORD GetWeaponType() const;
- BYTE GetSize() const;
- BOOL IsAntiFlag(DWORD dwFlag) const;
- BOOL IsFlag(DWORD dwFlag) const;
- BOOL IsWearableFlag(DWORD dwFlag) const;
- BOOL HasNextGrade() const;
- DWORD GetWearFlags() const;
- DWORD GetIBuyItemPrice() const;
- DWORD GetISellItemPrice() const;
- BOOL GetLimit(BYTE byIndex, TItemLimit * pItemLimit) const;
- BOOL GetApply(BYTE byIndex, TItemApply * pItemApply) const;
- long GetValue(BYTE byIndex) const;
- long GetSocket(BYTE byIndex) const;
- long SetSocket(BYTE byIndex,DWORD value);
- int GetSocketCount() const;
- DWORD GetIconNumber() const;
- UINT GetSpecularPoweru() const;
- float GetSpecularPowerf() const;
- /////
- BOOL IsEquipment() const;
- /////
- //BOOL LoadItemData(const char * c_szFileName);
- void SetDefaultItemData(const char * c_szIconFileName, const char * c_szModelFileName = NULL);
- void SetItemTableData(TItemTable * pItemTable);
- #ifdef ENABLE_SASH_SYSTEM
- void SetItemScale(const std::string strJob, const std::string strSex, const std::string strScaleX, const std::string strScaleY, const std::string strScaleZ, const std::string strPositionX, const std::string strPositionY, const std::string strPositionZ);
- bool GetItemScale(DWORD dwPos, float & fScaleX, float & fScaleY, float & fScaleZ, float & fPositionX, float & fPositionY, float & fPositionZ);
- #endif
- protected:
- void __LoadFiles();
- void __SetIconImage(const char * c_szFileName);
- protected:
- std::string m_strModelFileName;
- std::string m_strSubModelFileName;
- std::string m_strDropModelFileName;
- std::string m_strIconFileName;
- std::string m_strDescription;
- std::string m_strSummary;
- std::vector<std::string> m_strLODModelFileNameVector;
- CGraphicThing * m_pModelThing;
- CGraphicThing * m_pSubModelThing;
- CGraphicThing * m_pDropModelThing;
- CGraphicSubImage * m_pIconImage;
- std::vector<CGraphicThing *> m_pLODModelThingVector;
- NRaceData::TAttachingDataVector m_AttachingDataVector;
- DWORD m_dwVnum;
- TItemTable m_ItemTable;
- #ifdef ENABLE_SASH_SYSTEM
- TScaleTable m_ScaleTable;
- #endif
- public:
- static void DestroySystem();
- static CItemData* New();
- static void Delete(CItemData* pkItemData);
- static CDynamicPool<CItemData> ms_kPool;
- };
RaceData.h
- #pragma once
- #include "../eterGrnLib/Thing.h"
- class CRaceMotionData;
- class CAttributeData;
- #define COMBO_KEY DWORD
- #define MAKE_COMBO_KEY(motion_mode, combo_type) ( (DWORD(motion_mode) << 16) | (DWORD(combo_type)) )
- #define COMBO_KEY_GET_MOTION_MODE(key) ( WORD(DWORD(key) >> 16 & 0xFFFF) )
- #define COMBO_KEY_GET_COMBO_TYPE(key) ( WORD(DWORD(key) & 0xFFFF) )
- class CRaceData
- {
- public:
- enum EParts
- {
- // Share index with server
- // ECharacterEquipmentPartµµ ¼öÁ¤ÇØÁÖ¼¼¿ä.
- //ÆÐŶ Å©±â°¡ º¯ÇÕ´Ï´Ù ¼¹ö¿Í »óÀÇÈÄ Ãß°¡ÇØÁÖ¼¼¿ä.
- PART_MAIN,
- PART_WEAPON,
- PART_HEAD,
- PART_WEAPON_LEFT,
- PART_HAIR,
- PART_SASH = 5,
- PART_MAX_NUM,
- };
- enum
- {
- SMOKE_NUM = 4,
- };
- /////////////////////////////////////////////////////////////////////////////////
- // Graphic Resource
- // Model
- typedef std::map<WORD, CGraphicThing*> TGraphicThingMap;
- typedef std::map<DWORD, std::string> TAttachingBoneNameMap;
- // Motion
- typedef struct SMotion
- {
- BYTE byPercentage;
- CGraphicThing * pMotion;
- CRaceMotionData * pMotionData;
- } TMotion;
- typedef std::vector<TMotion> TMotionVector;
- typedef std::map<WORD, TMotionVector> TMotionVectorMap;
- typedef struct SMotionModeData
- {
- WORD wMotionModeIndex;
- TMotionVectorMap MotionVectorMap;
- SMotionModeData() {}
- virtual ~SMotionModeData() {}
- } TMotionModeData;
- typedef std::map<WORD, TMotionModeData*> TMotionModeDataMap;
- typedef TMotionModeDataMap::iterator TMotionModeDataIterator;
- /////////////////////////////////////////////////////////////////////////////////
- // Model Data
- typedef struct SModelData
- {
- NRaceData::TAttachingDataVector AttachingDataVector;
- } TModelData;
- typedef std::map<DWORD, TModelData> TModelDataMap;
- typedef TModelDataMap::iterator TModelDataMapIterator;
- /////////////////////////////////////////////////////////////////////////////////
- // Motion Data
- typedef std::map<DWORD, CRaceMotionData*> TMotionDataMap;
- /////////////////////////////////////////////////////////////////////////////////
- // Combo Data
- typedef std::vector<DWORD> TComboIndexVector;
- typedef struct SComboAttackData
- {
- TComboIndexVector ComboIndexVector;
- } TComboData;
- typedef std::map<DWORD, DWORD> TNormalAttackIndexMap;
- typedef std::map<COMBO_KEY, TComboData> TComboAttackDataMap;
- typedef TComboAttackDataMap::iterator TComboAttackDataIterator;
- struct SSkin
- {
- int m_ePart;
- std::string m_stSrcFileName;
- std::string m_stDstFileName;
- SSkin()
- {
- m_ePart=0;
- }
- SSkin(const SSkin& c_rkSkin)
- {
- Copy(c_rkSkin);
- }
- void operator=(const SSkin& c_rkSkin)
- {
- Copy(c_rkSkin);
- }
- void Copy(const SSkin& c_rkSkin)
- {
- m_ePart=c_rkSkin.m_ePart;
- m_stSrcFileName=c_rkSkin.m_stSrcFileName;
- m_stDstFileName=c_rkSkin.m_stDstFileName;
- }
- };
- struct SHair
- {
- std::string m_stModelFileName;
- std::vector<SSkin> m_kVct_kSkin;
- };
- struct SShape
- {
- std::string m_stModelFileName;
- std::vector<SSkin> m_kVct_kSkin;
- };
- public:
- static CRaceData* New();
- static void Delete(CRaceData* pkRaceData);
- static void CreateSystem(UINT uCapacity, UINT uMotModeCapacity);
- static void DestroySystem();
- public:
- CRaceData();
- virtual ~CRaceData();
- void Destroy();
- // Codes For Client
- const char* GetBaseModelFileName() const;
- const char* GetAttributeFileName() const;
- const char* GetMotionListFileName() const;
- CGraphicThing * GetBaseModelThing();
- CGraphicThing * GetLODModelThing();
- CAttributeData * GetAttributeDataPtr();
- BOOL GetAttachingBoneName(DWORD dwPartIndex, const char ** c_pszBoneName);
- BOOL CreateMotionModeIterator(TMotionModeDataIterator & itor);
- BOOL NextMotionModeIterator(TMotionModeDataIterator & itor);
- BOOL GetMotionKey(WORD wMotionModeIndex, WORD wMotionIndex, MOTION_KEY * pMotionKey);
- BOOL GetMotionModeDataPointer(WORD wMotionMode, TMotionModeData ** ppMotionModeData);
- BOOL GetModelDataPointer(DWORD dwModelIndex, const TModelData ** c_ppModelData);
- BOOL GetMotionVectorPointer(WORD wMotionMode, WORD wMotionIndex, const TMotionVector ** c_ppMotionVector);
- BOOL GetMotionDataPointer(WORD wMotionMode, WORD wMotionIndex, WORD wMotionSubIndex, CRaceMotionData** ppMotionData);
- BOOL GetMotionDataPointer(DWORD dwMotionKey, CRaceMotionData ** ppMotionData);
- DWORD GetAttachingDataCount();
- BOOL GetAttachingDataPointer(DWORD dwIndex, const NRaceData::TAttachingData ** c_ppAttachingData);
- BOOL GetCollisionDataPointer(DWORD dwIndex, const NRaceData::TAttachingData ** c_ppAttachingData);
- BOOL GetBodyCollisionDataPointer(const NRaceData::TAttachingData ** c_ppAttachingData);
- BOOL IsTree();
- const char * GetTreeFileName();
- ///////////////////////////////////////////////////////////////////
- // Setup by Script
- BOOL LoadRaceData(const char * c_szFileName);
- CGraphicThing* RegisterMotionData(WORD wMotionMode, WORD wMotionIndex, const char * c_szFileName, BYTE byPercentage = 100);
- ///////////////////////////////////////////////////////////////////
- // Setup by Python
- void SetRace(DWORD dwRaceIndex);
- void RegisterAttachingBoneName(DWORD dwPartIndex, const char * c_szBoneName);
- void RegisterMotionMode(WORD wMotionModeIndex);
- void SetMotionModeParent(WORD wParentMotionModeIndex, WORD wMotionModeIndex);
- void OLD_RegisterMotion(WORD wMotionModeIndex, WORD wMotionIndex, const char * c_szFileName, BYTE byPercentage = 100);
- CGraphicThing* NEW_RegisterMotion(CRaceMotionData* pkMotionData, WORD wMotionModeIndex, WORD wMotionIndex, const char * c_szFileName, BYTE byPercentage = 100);
- bool SetMotionRandomWeight(WORD wMotionModeIndex, WORD wMotionIndex, WORD wMotionSubIndex, BYTE byPercentage);
- void RegisterNormalAttack(WORD wMotionModeIndex, WORD wMotionIndex);
- BOOL GetNormalAttackIndex(WORD wMotionModeIndex, WORD * pwMotionIndex);
- void ReserveComboAttack(WORD wMotionModeIndex, WORD wComboType, DWORD dwComboCount);
- void RegisterComboAttack(WORD wMotionModeIndex, WORD wComboType, DWORD dwComboIndex, WORD wMotionIndex);
- BOOL GetComboDataPointer(WORD wMotionModeIndex, WORD wComboType, TComboData ** ppComboData);
- void SetShapeModel(UINT eShape, const char* c_szModelFileName);
- void AppendShapeSkin(UINT eShape, UINT ePart, const char* c_szSrcFileName, const char* c_szDstFileName);
- void SetHairSkin(UINT eHair, UINT ePart, const char* c_szModelFileName, const char* c_szSrcFileName, const char* c_szDstFileName);
- /////
- DWORD GetSmokeEffectID(UINT eSmoke);
- const std::string& GetSmokeBone();
- SHair* FindHair(UINT eHair);
- SShape* FindShape(UINT eShape);
- protected:
- void __Initialize();
- void __OLD_RegisterMotion(WORD wMotionMode, WORD wMotionIndex, const TMotion & rMotion);
- BOOL GetMotionVectorPointer(WORD wMotionMode, WORD wMotionIndex, TMotionVector ** ppMotionVector);
- protected:
- DWORD m_dwRaceIndex;
- DWORD m_adwSmokeEffectID[SMOKE_NUM];
- CGraphicThing * m_pBaseModelThing;
- CGraphicThing * m_pLODModelThing;
- std::string m_strBaseModelFileName;
- std::string m_strTreeFileName;
- std::string m_strAttributeFileName;
- std::string m_strMotionListFileName;
- std::string m_strSmokeBoneName;
- TModelDataMap m_ModelDataMap;
- TMotionModeDataMap m_pMotionModeDataMap;
- TAttachingBoneNameMap m_AttachingBoneNameMap;
- TComboAttackDataMap m_ComboAttackDataMap;
- TNormalAttackIndexMap m_NormalAttackIndexMap;
- std::map<DWORD, SHair> m_kMap_dwHairKey_kHair;
- std::map<DWORD, SShape> m_kMap_dwShapeKey_kShape;
- NRaceData::TAttachingDataVector m_AttachingDataVector;
- protected:
- static CDynamicPool<TMotionModeData> ms_MotionModeDataPool;
- static CDynamicPool<CRaceData> ms_kPool;
- };
Packet.h - Client side
- #pragma once
- #ifdef USE_AHNLAB_HACKSHIELD
- #include "Hackshield.h"
- #include METIN2HS_INCLUDE_ANTICPXSVR
- #else
- #pragma pack(push) //±âÁ¸ alignment ÀúÀå
- #pragma pack(8)
- #define ANTICPX_TRANS_BUFFER_MAX 400
- typedef struct _AHNHS_TRANS_BUFFER
- {
- unsigned char byBuffer[ANTICPX_TRANS_BUFFER_MAX/* ¼Û¼ö½Å ÆÐŶÀÇ ÃÖ´ë Å©±â */];
- unsigned short nLength;
- } AHNHS_TRANS_BUFFER, *PAHNHS_TRANS_BUFFER;
- #pragma pack(pop) // ±âÁ¸ alignment º¹±¸.
- #endif /* !USE_AHNLAB_HACKSHIELD */
- #include "../gamelib/RaceData.h"
- typedef BYTE TPacketHeader;
- enum
- {
- /////////////////////////////////////////////////
- // To Server
- // HEADER_BLANK is the not use(for future use)
- HEADER_CG_LOGIN = 1,
- HEADER_CG_ATTACK = 2,
- HEADER_CG_CHAT = 3,
- HEADER_CG_PLAYER_CREATE = 4, // »õ·Î¿î Ç÷¡À̾ »ý¼º
- HEADER_CG_PLAYER_DESTROY = 5, // Ç÷¡À̾ »èÁ¦.
- HEADER_CG_PLAYER_SELECT = 6,
- HEADER_CG_CHARACTER_MOVE = 7,
- HEADER_CG_SYNC_POSITION = 8,
- HEADER_CG_DIRECT_ENTER = 9,
- HEADER_CG_ENTERGAME = 10,
- HEADER_CG_ITEM_USE = 11,
- HEADER_CG_ITEM_DROP = 12,
- HEADER_CG_ITEM_MOVE = 13,
- HEADER_CG_ITEM_PICKUP = 15,
- HEADER_CG_QUICKSLOT_ADD = 16,
- HEADER_CG_QUICKSLOT_DEL = 17,
- HEADER_CG_QUICKSLOT_SWAP = 18,
- HEADER_CG_WHISPER = 19,
- HEADER_CG_ITEM_DROP2 = 20,
- //HEADER_BLANK21 = 21,
- //HEADER_BLANK22 = 22,
- //HEADER_BLANK22 = 23,
- //HEADER_BLANK24 = 24,
- //HEADER_BLANK25 = 25,
- HEADER_CG_ON_CLICK = 26,
- HEADER_CG_EXCHANGE = 27,
- HEADER_CG_CHARACTER_POSITION = 28,
- HEADER_CG_SCRIPT_ANSWER = 29,
- HEADER_CG_QUEST_INPUT_STRING = 30,
- HEADER_CG_QUEST_CONFIRM = 31,
- //HEADER_BLANK32 = 32,
- //HEADER_BLANK33 = 33,
- //HEADER_BLANK34 = 34,
- //HEADER_BLANK35 = 35,
- //HEADER_BLANK36 = 36,
- //HEADER_BLANK37 = 37,
- //HEADER_BLANK38 = 38,
- //HEADER_BLANK39 = 39,
- //HEADER_BLANK40 = 40,
- HEADER_CG_PVP = 41,
- //HEADER_BLANK42 = 42,
- //HEADER_BLANK43 = 43,
- //HEADER_BLANK44 = 44,
- //HEADER_BLANK45 = 45,
- //HEADER_BLANK46 = 46,
- //HEADER_BLANK47 = 47,
- //HEADER_BLANK48 = 48,
- //HEADER_BLANK49 = 49,
- HEADER_CG_SHOP = 50,
- HEADER_CG_FLY_TARGETING = 51,
- HEADER_CG_USE_SKILL = 52,
- HEADER_CG_ADD_FLY_TARGETING = 53,
- HEADER_CG_SHOOT = 54,
- HEADER_CG_MYSHOP = 55,
- //HEADER_BLANK56 = 56,
- //HEADER_BLANK57 = 57,
- //HEADER_BLANK58 = 58,
- //HEADER_BLANK59 = 59,
- HEADER_CG_ITEM_USE_TO_ITEM = 60,
- HEADER_CG_TARGET = 61,
- //HEADER_BLANK62 = 62,
- //HEADER_BLANK63 = 63,
- //HEADER_BLANK64 = 64,
- HEADER_CG_WARP = 65,
- HEADER_CG_SCRIPT_BUTTON = 66,
- HEADER_CG_MESSENGER = 67,
- //HEADER_BLANK68 = 68,
- HEADER_CG_MALL_CHECKOUT = 69,
- HEADER_CG_SAFEBOX_CHECKIN = 70, // ¾ÆÀÌÅÛÀ» â°í¿¡ ³Ö´Â´Ù.
- HEADER_CG_SAFEBOX_CHECKOUT = 71, // ¾ÆÀÌÅÛÀ» â°í·Î ºÎÅÍ »©¿Â´Ù.
- HEADER_CG_PARTY_INVITE = 72,
- HEADER_CG_PARTY_INVITE_ANSWER = 73,
- HEADER_CG_PARTY_REMOVE = 74,
- HEADER_CG_PARTY_SET_STATE = 75,
- HEADER_CG_PARTY_USE_SKILL = 76,
- HEADER_CG_SAFEBOX_ITEM_MOVE = 77,
- HEADER_CG_PARTY_PARAMETER = 78,
- //HEADER_BLANK68 = 79,
- HEADER_CG_GUILD = 80,
- HEADER_CG_ANSWER_MAKE_GUILD = 81,
- HEADER_CG_FISHING = 82,
- HEADER_CG_GIVE_ITEM = 83,
- //HEADER_BLANK84 = 84,
- //HEADER_BLANK85 = 85,
- //HEADER_BLANK86 = 86,
- //HEADER_BLANK87 = 87,
- //HEADER_BLANK88 = 88,
- //HEADER_BLANK89 = 89,
- HEADER_CG_EMPIRE = 90,
- //HEADER_BLANK91 = 91,
- //HEADER_BLANK92 = 92,
- //HEADER_BLANK93 = 93,
- //HEADER_BLANK94 = 94,
- //HEADER_BLANK95 = 95,
- HEADER_CG_REFINE = 96,
- //HEADER_BLANK97 = 97,
- //HEADER_BLANK98 = 98,
- //HEADER_BLANK99 = 99,
- HEADER_CG_MARK_LOGIN = 100,
- HEADER_CG_MARK_CRCLIST = 101,
- HEADER_CG_MARK_UPLOAD = 102,
- HEADER_CG_MARK_IDXLIST = 104,
- HEADER_CG_CRC_REPORT = 103,
- HEADER_CG_HACK = 105,
- HEADER_CG_CHANGE_NAME = 106,
- HEADER_CG_SMS = 107,
- HEADER_CG_CHINA_MATRIX_CARD = 108,
- HEADER_CG_LOGIN2 = 109,
- HEADER_CG_DUNGEON = 110,
- HEADER_CG_LOGIN3 = 111,
- HEADER_CG_GUILD_SYMBOL_UPLOAD = 112,
- HEADER_CG_GUILD_SYMBOL_CRC = 113,
- HEADER_CG_SCRIPT_SELECT_ITEM = 114,
- HEADER_CG_LOGIN4 = 115,
- HEADER_CG_LOGIN5_OPENID = 116, //OpenID : ½ÇÇà½Ã ¹ÞÀº ÀÎÁõÅ°¸¦ ¼¹ö¿¡ º¸³¿.
- HEADER_CG_RUNUP_MATRIX_ANSWER = 201,
- HEADER_CG_NEWCIBN_PASSPOD_ANSWER = 202,
- HEADER_CG_HS_ACK = 203,
- HEADER_CG_XTRAP_ACK = 204,
- HEADER_CG_DRAGON_SOUL_REFINE = 205,
- HEADER_CG_STATE_CHECKER = 206,
- #ifdef __AUCTION__
- HEADER_CG_AUCTION_CMD = 205,
- #endif
- HEADER_CG_KEY_AGREEMENT = 0xfb, // _IMPROVED_PACKET_ENCRYPTION_
- HEADER_CG_TIME_SYNC = 0xfc,
- HEADER_CG_CLIENT_VERSION = 0xfd,
- HEADER_CG_CLIENT_VERSION2 = 0xf1,
- HEADER_CG_PONG = 0xfe,
- HEADER_CG_HANDSHAKE = 0xff,
- /////////////////////////////////////////////////
- // From Server
- HEADER_GC_CHARACTER_ADD = 1,
- HEADER_GC_CHARACTER_DEL = 2,
- HEADER_GC_CHARACTER_MOVE = 3,
- HEADER_GC_CHAT = 4,
- HEADER_GC_SYNC_POSITION = 5,
- HEADER_GC_LOGIN_SUCCESS3 = 6,
- HEADER_GC_LOGIN_FAILURE = 7,
- HEADER_GC_PLAYER_CREATE_SUCCESS = 8,
- HEADER_GC_PLAYER_CREATE_FAILURE = 9,
- HEADER_GC_PLAYER_DELETE_SUCCESS = 10,
- HEADER_GC_PLAYER_DELETE_WRONG_SOCIAL_ID = 11,
- // 12
- HEADER_GC_STUN = 13,
- HEADER_GC_DEAD = 14,
- HEADER_GC_MAIN_CHARACTER = 15,
- HEADER_GC_PLAYER_POINTS = 16,
- HEADER_GC_PLAYER_POINT_CHANGE = 17,
- HEADER_GC_CHANGE_SPEED = 18,
- HEADER_GC_CHARACTER_UPDATE = 19,
- #if defined(GAIDEN)
- HEADER_GC_ITEM_DEL = 20, // ¾ÆÀÌÅÛ Ã¢¿¡ Ãß°¡
- HEADER_GC_ITEM_SET = 21, // ¾ÆÀÌÅÛ Ã¢¿¡ Ãß°¡
- #else
- HEADER_GC_ITEM_SET = 20, // ¾ÆÀÌÅÛ Ã¢¿¡ Ãß°¡
- HEADER_GC_ITEM_SET2 = 21, // ¾ÆÀÌÅÛ Ã¢¿¡ Ãß°¡
- #endif
- HEADER_GC_ITEM_USE = 22, // ¾ÆÀÌÅÛ »ç¿ë (ÁÖÀ§ »ç¶÷µé¿¡°Ô º¸¿©ÁÖ±â À§ÇØ)
- HEADER_GC_ITEM_DROP = 23, // ¾ÆÀÌÅÛ ¹ö¸®±â
- HEADER_GC_ITEM_UPDATE = 25, // ¾ÆÀÌÅÛ ¼öÄ¡ ¾÷µ¥ÀÌÆ®
- HEADER_GC_ITEM_GROUND_ADD = 26, // ¹Ù´Ú¿¡ ¾ÆÀÌÅÛ Ãß°¡
- HEADER_GC_ITEM_GROUND_DEL = 27, // ¹Ù´Ú¿¡¼ ¾ÆÀÌÅÛ »èÁ¦
- HEADER_GC_QUICKSLOT_ADD = 28,
- HEADER_GC_QUICKSLOT_DEL = 29,
- HEADER_GC_QUICKSLOT_SWAP = 30,
- HEADER_GC_ITEM_OWNERSHIP = 31,
- HEADER_GC_LOGIN_SUCCESS4 = 32,
- HEADER_GC_ITEM_UNBIND_TIME = 33,
- HEADER_GC_WHISPER = 34,
- HEADER_GC_ALERT = 35,
- HEADER_GC_MOTION = 36,
- HEADER_GC_SHOP = 38,
- HEADER_GC_SHOP_SIGN = 39,
- // 39 ~ 41 Balnk
- HEADER_GC_DUEL_START = 40,
- HEADER_GC_PVP = 41,
- HEADER_GC_EXCHANGE = 42,
- HEADER_GC_CHARACTER_POSITION = 43,
- HEADER_GC_PING = 44,
- HEADER_GC_SCRIPT = 45,
- HEADER_GC_QUEST_CONFIRM = 46,
- HEADER_GC_MOUNT = 61,
- HEADER_GC_OWNERSHIP = 62,
- HEADER_GC_TARGET = 63,
- HEADER_GC_WARP = 65,
- HEADER_GC_ADD_FLY_TARGETING = 69,
- HEADER_GC_CREATE_FLY = 70,
- HEADER_GC_FLY_TARGETING = 71,
- HEADER_GC_SKILL_LEVEL = 72,
- HEADER_GC_SKILL_COOLTIME_END = 73,
- HEADER_GC_MESSENGER = 74,
- HEADER_GC_GUILD = 75,
- HEADER_GC_SKILL_LEVEL_NEW = 76,
- HEADER_GC_PARTY_INVITE = 77,
- HEADER_GC_PARTY_ADD = 78,
- HEADER_GC_PARTY_UPDATE = 79,
- HEADER_GC_PARTY_REMOVE = 80,
- HEADER_GC_QUEST_INFO = 81,
- HEADER_GC_REQUEST_MAKE_GUILD = 82,
- HEADER_GC_PARTY_PARAMETER = 83,
- HEADER_GC_SAFEBOX_MONEY_CHANGE = 84,
- HEADER_GC_SAFEBOX_SET = 85,
- HEADER_GC_SAFEBOX_DEL = 86,
- HEADER_GC_SAFEBOX_WRONG_PASSWORD = 87,
- HEADER_GC_SAFEBOX_SIZE = 88,
- HEADER_GC_FISHING = 89,
- HEADER_GC_EMPIRE = 90,
- HEADER_GC_PARTY_LINK = 91,
- HEADER_GC_PARTY_UNLINK = 92,
- HEADER_GC_REFINE_INFORMATION = 95,
- HEADER_GC_OBSERVER_ADD = 96,
- HEADER_GC_OBSERVER_REMOVE = 97,
- HEADER_GC_OBSERVER_MOVE = 98,
- HEADER_GC_VIEW_EQUIP = 99,
- HEADER_GC_MARK_BLOCK = 100,
- HEADER_GC_MARK_DIFF_DATA = 101,
- HEADER_GC_MARK_IDXLIST = 102,
- //HEADER_GC_SLOW_TIMER = 105,
- HEADER_GC_TIME = 106,
- HEADER_GC_CHANGE_NAME = 107,
- HEADER_GC_DUNGEON = 110,
- HEADER_GC_WALK_MODE = 111,
- HEADER_GC_CHANGE_SKILL_GROUP = 112,
- #if defined(GAIDEN)
- HEADER_GC_MAIN_CHARACTER = 113,
- HEADER_GC_MAIN_CHARACTER3_BGM = 137,
- HEADER_GC_MAIN_CHARACTER4_BGM_VOL = 138,
- #else
- // SUPPORT_BGM
- HEADER_GC_MAIN_CHARACTER2_EMPIRE = 113,
- // END_OF_SUPPORT_BGM
- #endif
- HEADER_GC_SEPCIAL_EFFECT = 114,
- HEADER_GC_NPC_POSITION = 115,
- HEADER_GC_CHINA_MATRIX_CARD = 116,
- HEADER_GC_CHARACTER_UPDATE2 = 117,
- HEADER_GC_LOGIN_KEY = 118,
- HEADER_GC_REFINE_INFORMATION_NEW = 119,
- HEADER_GC_CHARACTER_ADD2 = 120,
- HEADER_GC_CHANNEL = 121,
- HEADER_GC_MALL_OPEN = 122,
- HEADER_GC_TARGET_UPDATE = 123,
- HEADER_GC_TARGET_DELETE = 124,
- HEADER_GC_TARGET_CREATE_NEW = 125,
- HEADER_GC_AFFECT_ADD = 126,
- HEADER_GC_AFFECT_REMOVE = 127,
- HEADER_GC_MALL_SET = 128,
- HEADER_GC_MALL_DEL = 129,
- HEADER_GC_LAND_LIST = 130,
- HEADER_GC_LOVER_INFO = 131,
- HEADER_GC_LOVE_POINT_UPDATE = 132,
- HEADER_GC_GUILD_SYMBOL_DATA = 133,
- HEADER_GC_DIG_MOTION = 134,
- HEADER_GC_DAMAGE_INFO = 135,
- HEADER_GC_CHAR_ADDITIONAL_INFO = 136,
- // SUPPORT_BGM
- HEADER_GC_MAIN_CHARACTER3_BGM = 137,
- HEADER_GC_MAIN_CHARACTER4_BGM_VOL = 138,
- // END_OF_SUPPORT_BGM
- HEADER_GC_AUTH_SUCCESS = 150,
- HEADER_GC_PANAMA_PACK = 151,
- //HYBRID CRYPT
- HEADER_GC_HYBRIDCRYPT_KEYS = 152,
- HEADER_GC_HYBRIDCRYPT_SDB = 153, // SDB means Supplmentary Data Blocks
- //HYBRID CRYPT
- HEADER_GC_AUTH_SUCCESS_OPENID = 154,
- HEADER_GC_RUNUP_MATRIX_QUIZ = 201,
- HEADER_GC_NEWCIBN_PASSPOD_REQUEST = 202,
- HEADER_GC_NEWCIBN_PASSPOD_FAILURE = 203,
- #if defined(GAIDEN)
- HEADER_GC_ONTIME = 204,
- HEADER_GC_RESET_ONTIME = 205,
- // AUTOBAN
- HEADER_GC_AUTOBAN_QUIZ = 206,
- // END_OF_AUTOBAN
- HEADER_GC_HS_REQUEST = 207, // Origially it's 204 on devel branch
- #else
- HEADER_GC_HS_REQUEST = 204,
- HEADER_GC_XTRAP_CS1_REQUEST = 205,
- #endif
- #ifdef __AUCTION__
- HEADER_GC_AUCTOIN_ITEM_LIST = 206,
- #endif
- HEADER_GC_SPECIFIC_EFFECT = 208,
- HEADER_GC_DRAGON_SOUL_REFINE = 209,
- HEADER_GC_RESPOND_CHANNELSTATUS = 210,
- HEADER_GC_KEY_AGREEMENT_COMPLETED = 0xfa, // _IMPROVED_PACKET_ENCRYPTION_
- HEADER_GC_KEY_AGREEMENT = 0xfb, // _IMPROVED_PACKET_ENCRYPTION_
- HEADER_GC_HANDSHAKE_OK = 0xfc, // 252
- HEADER_GC_PHASE = 0xfd, // 253
- HEADER_GC_BINDUDP = 0xfe, // 254
- HEADER_GC_HANDSHAKE = 0xff, // 255
- /////////////////////////////////////////////////
- // Client To Client for UDP
- /*
- HEADER_CC_STATE_WAITING = 1,
- HEADER_CC_STATE_WALKING = 2,
- HEADER_CC_STATE_GOING = 3,
- HEADER_CC_EVENT_NORMAL_ATTACKING = 4,
- HEADER_CC_EVENT_COMBO_ATTACKING = 5,
- HEADER_CC_EVENT_HIT = 6,
- */
- };
- enum
- {
- ID_MAX_NUM = 30,
- PASS_MAX_NUM = 16,
- CHAT_MAX_NUM = 128,
- PATH_NODE_MAX_NUM = 64,
- SHOP_SIGN_MAX_LEN = 32,
- PLAYER_PER_ACCOUNT3 = 3,
- PLAYER_PER_ACCOUNT4 = 4,
- PLAYER_ITEM_SLOT_MAX_NUM = 20, // Ç÷¡À̾îÀÇ ½½·Ô´ç µé¾î°¡´Â °¹¼ö.
- QUICKSLOT_MAX_LINE = 4,
- QUICKSLOT_MAX_COUNT_PER_LINE = 8, // Ŭ¶óÀ̾ðÆ® ÀÓÀÇ °áÁ¤°ª
- QUICKSLOT_MAX_COUNT = QUICKSLOT_MAX_LINE * QUICKSLOT_MAX_COUNT_PER_LINE,
- QUICKSLOT_MAX_NUM = 36, // ¼¹ö¿Í ¸ÂÃçÁ® ÀÖ´Â °ª
- SHOP_HOST_ITEM_MAX_NUM = 40,
- METIN_SOCKET_COUNT = 6,
- PARTY_AFFECT_SLOT_MAX_NUM = 7,
- GUILD_GRADE_NAME_MAX_LEN = 8,
- GUILD_NAME_MAX_LEN = 12,
- GUILD_GRADE_COUNT = 15,
- GULID_COMMENT_MAX_LEN = 50,
- MARK_CRC_NUM = 8*8,
- MARK_DATA_SIZE = 16*12,
- SYMBOL_DATA_SIZE = 128*256,
- QUEST_INPUT_STRING_MAX_NUM = 64,
- PRIVATE_CODE_LENGTH = 8,
- REFINE_MATERIAL_MAX_NUM = 5,
- CHINA_MATRIX_ANSWER_MAX_LEN = 8,
- RUNUP_MATRIX_QUIZ_MAX_LEN = 8,
- RUNUP_MATRIX_ANSWER_MAX_LEN = 4,
- NEWCIBN_PASSPOD_ANSWER_MAX_LEN = 8,
- NEWCIBN_PASSPOD_FAILURE_MAX_LEN = 128,
- WEAR_MAX_NUM = 11,
- OPENID_AUTHKEY_LEN = 32,
- SHOP_TAB_NAME_MAX = 32,
- SHOP_TAB_COUNT_MAX = 3,
- };
- #pragma pack(push)
- #pragma pack(1)
- /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- // Mark
- typedef struct command_mark_login
- {
- BYTE header;
- DWORD handle;
- DWORD random_key;
- } TPacketCGMarkLogin;
- typedef struct command_mark_upload
- {
- BYTE header;
- DWORD gid;
- BYTE image[16*12*4];
- } TPacketCGMarkUpload;
- typedef struct command_mark_idxlist
- {
- BYTE header;
- } TPacketCGMarkIDXList;
- typedef struct command_mark_crclist
- {
- BYTE header;
- BYTE imgIdx;
- DWORD crclist[80];
- } TPacketCGMarkCRCList;
- typedef struct packet_mark_idxlist
- {
- BYTE header;
- DWORD bufSize;
- WORD count;
- //µÚ¿¡ size * (WORD + WORD)¸¸Å µ¥ÀÌÅÍ ºÙÀ½
- } TPacketGCMarkIDXList;
- typedef struct packet_mark_block
- {
- BYTE header;
- DWORD bufSize;
- BYTE imgIdx;
- DWORD count;
- // µÚ¿¡ 64 x 48 x Çȼ¿Å©±â(4¹ÙÀÌÆ®) = 12288¸¸Å µ¥ÀÌÅÍ ºÙÀ½
- } TPacketGCMarkBlock;
- typedef struct command_symbol_upload
- {
- BYTE header;
- WORD size;
- DWORD handle;
- } TPacketCGSymbolUpload;
- typedef struct command_symbol_crc
- {
- BYTE header;
- DWORD dwGuildID;
- DWORD dwCRC;
- DWORD dwSize;
- } TPacketCGSymbolCRC;
- typedef struct packet_symbol_data
- {
- BYTE header;
- WORD size;
- DWORD guild_id;
- } TPacketGCGuildSymbolData;
- //
- //
- //
- typedef struct packet_observer_add
- {
- BYTE header;
- DWORD vid;
- WORD x;
- WORD y;
- } TPacketGCObserverAdd;
- typedef struct packet_observer_move
- {
- BYTE header;
- DWORD vid;
- WORD x;
- WORD y;
- } TPacketGCObserverMove;
- typedef struct packet_observer_remove
- {
- BYTE header;
- DWORD vid;
- } TPacketGCObserverRemove;
- /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- // To Server
- typedef struct command_checkin
- {
- BYTE header;
- char name[ID_MAX_NUM+1];
- char pwd[PASS_MAX_NUM+1];
- } TPacketCGCheckin;
- typedef struct command_login
- {
- BYTE header;
- char name[ID_MAX_NUM + 1];
- char pwd[PASS_MAX_NUM + 1];
- } TPacketCGLogin;
- // start - ±ÇÇÑ ¼¹ö Á¢¼ÓÀ» À§ÇÑ ÆÐŶµé
- typedef struct command_login2
- {
- BYTE header;
- char name[ID_MAX_NUM + 1];
- DWORD login_key;
- DWORD adwClientKey[4];
- } TPacketCGLogin2;
- typedef struct command_login3
- {
- BYTE header;
- char name[ID_MAX_NUM + 1];
- char pwd[PASS_MAX_NUM + 1];
- DWORD adwClientKey[4];
- } TPacketCGLogin3;
- typedef struct command_login5
- {
- BYTE header;
- char authKey[OPENID_AUTHKEY_LEN + 1];
- DWORD adwClientKey[4];
- } TPacketCGLogin5;
- // end - ±ÇÇÑ ¼¹ö Á¢¼ÓÀ» À§ÇÑ ÆÐŶµé
- typedef struct command_direct_enter
- {
- BYTE bHeader;
- char login[ID_MAX_NUM + 1];
- char passwd[PASS_MAX_NUM + 1];
- BYTE index;
- } TPacketCGDirectEnter;
- typedef struct command_player_select
- {
- BYTE header;
- BYTE player_index;
- } TPacketCGSelectCharacter;
- typedef struct command_attack
- {
- BYTE header;
- BYTE bType; // °ø°Ý À¯Çü
- DWORD dwVictimVID; // Àû VID
- BYTE bCRCMagicCubeProcPiece;
- BYTE bCRCMagicCubeFilePiece;
- } TPacketCGAttack;
- typedef struct command_chat
- {
- BYTE header;
- WORD length;
- BYTE type;
- } TPacketCGChat;
- typedef struct command_whisper
- {
- BYTE bHeader;
- WORD wSize;
- char szNameTo[CHARACTER_NAME_MAX_LEN + 1];
- } TPacketCGWhisper;
- typedef struct command_sms
- {
- BYTE bHeader;
- WORD wSize;
- char szNameTo[CHARACTER_NAME_MAX_LEN + 1];
- } TPacketCGSMS;
- enum EBattleMode
- {
- BATTLEMODE_ATTACK = 0,
- BATTLEMODE_DEFENSE = 1,
- };
- typedef struct command_EnterFrontGame
- {
- BYTE header;
- } TPacketCGEnterFrontGame;
- typedef struct command_item_use
- {
- BYTE header;
- TItemPos pos;
- } TPacketCGItemUse;
- typedef struct command_item_use_to_item
- {
- BYTE header;
- TItemPos source_pos;
- TItemPos target_pos;
- } TPacketCGItemUseToItem;
- typedef struct command_item_drop
- {
- BYTE header;
- TItemPos pos;
- DWORD elk;
- } TPacketCGItemDrop;
- typedef struct command_item_drop2
- {
- BYTE header;
- TItemPos pos;
- DWORD gold;
- WORD count;
- } TPacketCGItemDrop2;
- typedef struct command_item_move
- {
- BYTE header;
- TItemPos pos;
- TItemPos change_pos;
- WORD num;
- } TPacketCGItemMove;
- typedef struct command_item_pickup
- {
- BYTE header;
- DWORD vid;
- } TPacketCGItemPickUp;
- typedef struct command_quickslot_add
- {
- BYTE header;
- BYTE pos;
- TQuickSlot slot;
- }TPacketCGQuickSlotAdd;
- typedef struct command_quickslot_del
- {
- BYTE header;
- BYTE pos;
- }TPacketCGQuickSlotDel;
- typedef struct command_quickslot_swap
- {
- BYTE header;
- BYTE pos;
- BYTE change_pos;
- }TPacketCGQuickSlotSwap;
- typedef struct command_on_click
- {
- BYTE header;
- DWORD vid;
- } TPacketCGOnClick;
- enum
- {
- SHOP_SUBHEADER_CG_END,
- SHOP_SUBHEADER_CG_BUY,
- SHOP_SUBHEADER_CG_SELL,
- SHOP_SUBHEADER_CG_SELL2,
- };
- typedef struct command_shop
- {
- BYTE header;
- BYTE subheader;
- } TPacketCGShop;
- enum
- {
- EXCHANGE_SUBHEADER_CG_START, // arg1 == vid of target character
- EXCHANGE_SUBHEADER_CG_ITEM_ADD, // arg1 == position of item
- EXCHANGE_SUBHEADER_CG_ITEM_DEL, // arg1 == position of item
- EXCHANGE_SUBHEADER_CG_ELK_ADD, // arg1 == amount of elk
- EXCHANGE_SUBHEADER_CG_ACCEPT, // arg1 == not used
- EXCHANGE_SUBHEADER_CG_CANCEL, // arg1 == not used
- };
- typedef struct command_exchange
- {
- BYTE header;
- BYTE subheader;
- DWORD arg1;
- BYTE arg2;
- TItemPos Pos;
- } TPacketCGExchange;
- typedef struct command_position
- {
- BYTE header;
- BYTE position;
- } TPacketCGPosition;
- typedef struct command_script_answer
- {
- BYTE header;
- BYTE answer;
- } TPacketCGScriptAnswer;
- typedef struct command_script_button
- {
- BYTE header;
- unsigned int idx;
- } TPacketCGScriptButton;
- typedef struct command_target
- {
- BYTE header;
- DWORD dwVID;
- } TPacketCGTarget;
- typedef struct command_move
- {
- BYTE bHeader;
- BYTE bFunc;
- BYTE bArg;
- BYTE bRot;
- LONG lX;
- LONG lY;
- DWORD dwTime;
- } TPacketCGMove;
- typedef struct command_sync_position_element
- {
- DWORD dwVID;
- long lX;
- long lY;
- } TPacketCGSyncPositionElement;
- typedef struct command_sync_position
- {
- BYTE bHeader;
- WORD wSize;
- } TPacketCGSyncPosition;
- typedef struct command_fly_targeting
- {
- BYTE bHeader;
- DWORD dwTargetVID;
- long lX;
- long lY;
- } TPacketCGFlyTargeting;
- typedef struct packet_fly_targeting
- {
- BYTE bHeader;
- DWORD dwShooterVID;
- DWORD dwTargetVID;
- long lX;
- long lY;
- } TPacketGCFlyTargeting;
- typedef struct packet_shoot
- {
- BYTE bHeader;
- BYTE bType;
- } TPacketCGShoot;
- typedef struct command_warp
- {
- BYTE bHeader;
- } TPacketCGWarp;
- enum
- {
- MESSENGER_SUBHEADER_GC_LIST,
- MESSENGER_SUBHEADER_GC_LOGIN,
- MESSENGER_SUBHEADER_GC_LOGOUT,
- MESSENGER_SUBHEADER_GC_INVITE,
- MESSENGER_SUBHEADER_GC_MOBILE,
- };
- typedef struct packet_messenger
- {
- BYTE header;
- WORD size;
- BYTE subheader;
- } TPacketGCMessenger;
- typedef struct packet_messenger_list_offline
- {
- BYTE connected; // always 0
- BYTE length;
- } TPacketGCMessengerListOffline;
- enum
- {
- MESSENGER_CONNECTED_STATE_OFFLINE,
- MESSENGER_CONNECTED_STATE_ONLINE,
- MESSENGER_CONNECTED_STATE_MOBILE,
- };
- typedef struct packet_messenger_list_online
- {
- BYTE connected;
- BYTE length;
- //BYTE length_char_name;
- } TPacketGCMessengerListOnline;
- typedef struct packet_messenger_login
- {
- //BYTE length_login;
- //BYTE length_char_name;
- BYTE length;
- } TPacketGCMessengerLogin;
- typedef struct packet_messenger_logout
- {
- BYTE length;
- } TPacketGCMessengerLogout;
- enum
- {
- MESSENGER_SUBHEADER_CG_ADD_BY_VID,
- MESSENGER_SUBHEADER_CG_ADD_BY_NAME,
- MESSENGER_SUBHEADER_CG_REMOVE,
- };
- typedef struct command_messenger
- {
- BYTE header;
- BYTE subheader;
- } TPacketCGMessenger;
- typedef struct command_messenger_remove
- {
- BYTE length;
- } TPacketCGMessengerRemove;
- enum
- {
- SAFEBOX_MONEY_STATE_SAVE,
- SAFEBOX_MONEY_STATE_WITHDRAW,
- };
- typedef struct command_safebox_money
- {
- BYTE bHeader;
- BYTE bState;
- DWORD dwMoney;
- } TPacketCGSafeboxMoney;
- typedef struct command_safebox_checkout
- {
- BYTE bHeader;
- BYTE bSafePos;
- TItemPos ItemPos;
- } TPacketCGSafeboxCheckout;
- typedef struct command_safebox_checkin
- {
- BYTE bHeader;
- BYTE bSafePos;
- TItemPos ItemPos;
- } TPacketCGSafeboxCheckin;
- typedef struct command_mall_checkout
- {
- BYTE bHeader;
- BYTE bMallPos;
- TItemPos ItemPos;
- } TPacketCGMallCheckout;
- ///////////////////////////////////////////////////////////////////////////////////
- // Party
- typedef struct command_use_skill
- {
- BYTE bHeader;
- DWORD dwVnum;
- DWORD dwTargetVID;
- } TPacketCGUseSkill;
- typedef struct command_party_invite
- {
- BYTE header;
- DWORD vid;
- } TPacketCGPartyInvite;
- typedef struct command_party_invite_answer
- {
- BYTE header;
- DWORD leader_pid;
- BYTE accept;
- } TPacketCGPartyInviteAnswer;
- typedef struct command_party_remove
- {
- BYTE header;
- DWORD pid;
- } TPacketCGPartyRemove;
- typedef struct command_party_set_state
- {
- BYTE byHeader;
- DWORD dwVID;
- BYTE byState;
- BYTE byFlag;
- } TPacketCGPartySetState;
- typedef struct packet_party_link
- {
- BYTE header;
- DWORD pid;
- DWORD vid;
- } TPacketGCPartyLink;
- typedef struct packet_party_unlink
- {
- BYTE header;
- DWORD pid;
- DWORD vid;
- } TPacketGCPartyUnlink;
- typedef struct command_party_use_skill
- {
- BYTE byHeader;
- BYTE bySkillIndex;
- DWORD dwTargetVID;
- } TPacketCGPartyUseSkill;
- enum
- {
- GUILD_SUBHEADER_CG_ADD_MEMBER,
- GUILD_SUBHEADER_CG_REMOVE_MEMBER,
- GUILD_SUBHEADER_CG_CHANGE_GRADE_NAME,
- GUILD_SUBHEADER_CG_CHANGE_GRADE_AUTHORITY,
- GUILD_SUBHEADER_CG_OFFER,
- GUILD_SUBHEADER_CG_POST_COMMENT,
- GUILD_SUBHEADER_CG_DELETE_COMMENT,
- GUILD_SUBHEADER_CG_REFRESH_COMMENT,
- GUILD_SUBHEADER_CG_CHANGE_MEMBER_GRADE,
- GUILD_SUBHEADER_CG_USE_SKILL,
- GUILD_SUBHEADER_CG_CHANGE_MEMBER_GENERAL,
- GUILD_SUBHEADER_CG_GUILD_INVITE_ANSWER,
- GUILD_SUBHEADER_CG_CHARGE_GSP,
- GUILD_SUBHEADER_CG_DEPOSIT_MONEY,
- GUILD_SUBHEADER_CG_WITHDRAW_MONEY,
- };
- typedef struct command_guild
- {
- BYTE byHeader;
- BYTE bySubHeader;
- } TPacketCGGuild;
- typedef struct command_guild_answer_make_guild
- {
- BYTE header;
- char guild_name[GUILD_NAME_MAX_LEN+1];
- } TPacketCGAnswerMakeGuild;
- typedef struct command_give_item
- {
- BYTE byHeader;
- DWORD dwTargetVID;
- TItemPos ItemPos;
- BYTE byItemCount;
- } TPacketCGGiveItem;
- typedef struct SPacketCGHack
- {
- BYTE bHeader;
- char szBuf[255 + 1];
- } TPacketCGHack;
- typedef struct command_dungeon
- {
- BYTE bHeader;
- WORD size;
- } TPacketCGDungeon;
- // Private Shop
- typedef struct SShopItemTable
- {
- DWORD vnum;
- WORD count;
- TItemPos pos; // PC »óÁ¡¿¡¸¸ ÀÌ¿ë
- DWORD price; // PC »óÁ¡¿¡¸¸ ÀÌ¿ë
- BYTE display_pos; // PC »óÁ¡¿¡¸¸ ÀÌ¿ë, º¸ÀÏ À§Ä¡.
- } TShopItemTable;
- typedef struct SPacketCGMyShop
- {
- BYTE bHeader;
- char szSign[SHOP_SIGN_MAX_LEN + 1];
- BYTE bCount; // count of TShopItemTable, max 39
- } TPacketCGMyShop;
- typedef struct SPacketCGRefine
- {
- BYTE header;
- BYTE pos;
- BYTE type;
- } TPacketCGRefine;
- typedef struct SPacketCGChangeName
- {
- BYTE header;
- BYTE index;
- char name[CHARACTER_NAME_MAX_LEN+1];
- } TPacketCGChangeName;
- typedef struct command_client_version
- {
- BYTE header;
- char filename[32+1];
- char timestamp[32+1];
- } TPacketCGClientVersion;
- typedef struct command_client_version2
- {
- BYTE header;
- char filename[32+1];
- char timestamp[32+1];
- } TPacketCGClientVersion2;
- typedef struct command_crc_report
- {
- BYTE header;
- BYTE byPackMode;
- DWORD dwBinaryCRC32;
- DWORD dwProcessCRC32;
- DWORD dwRootPackCRC32;
- } TPacketCGCRCReport;
- typedef struct command_china_matrix_card
- {
- BYTE bHeader;
- char szAnswer[CHINA_MATRIX_ANSWER_MAX_LEN + 1];
- } TPacketCGChinaMatrixCard;
- typedef struct command_runup_matrix_answer
- {
- BYTE bHeader;
- char szAnswer[RUNUP_MATRIX_ANSWER_MAX_LEN + 1];
- } TPacketCGRunupMatrixAnswer;
- typedef struct command_newcibn_passpod_answer
- {
- BYTE bHeader;
- char szAnswer[NEWCIBN_PASSPOD_ANSWER_MAX_LEN + 1];
- } TPacketCGNEWCIBNPasspodAnswer;
- enum EPartyExpDistributionType
- {
- PARTY_EXP_DISTRIBUTION_NON_PARITY,
- PARTY_EXP_DISTRIBUTION_PARITY,
- };
- typedef struct command_party_parameter
- {
- BYTE bHeader;
- BYTE bDistributeMode;
- } TPacketCGPartyParameter;
- typedef struct command_quest_input_string
- {
- BYTE bHeader;
- char szString[QUEST_INPUT_STRING_MAX_NUM+1];
- } TPacketCGQuestInputString;
- typedef struct command_quest_confirm
- {
- BYTE header;
- BYTE answer;
- DWORD requestPID;
- } TPacketCGQuestConfirm;
- typedef struct command_script_select_item
- {
- BYTE header;
- DWORD selection;
- } TPacketCGScriptSelectItem;
- /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- // From Server
- enum EPhase
- {
- PHASE_CLOSE, // ²÷±â´Â »óÅ (¶Ç´Â ²÷±â Àü »óÅÂ)
- PHASE_HANDSHAKE, // ¾Ç¼ö..;;
- PHASE_LOGIN, // ·Î±×ÀÎ Áß
- PHASE_SELECT, // ij¸¯ÅÍ ¼±Åà ȸé
- PHASE_LOADING, // ¼±Åà ÈÄ ·Îµù ȸé
- PHASE_GAME, // °ÔÀÓ È¸é
- PHASE_DEAD, // Á×¾úÀ» ¶§.. (°ÔÀÓ ¾È¿¡ ÀÖ´Â °ÍÀÏ ¼öµµ..)
- PHASE_DBCLIENT_CONNECTING, // ¼¹ö¿ë
- PHASE_DBCLIENT, // ¼¹ö¿ë
- PHASE_P2P, // ¼¹ö¿ë
- PHASE_AUTH, // ·Î±×ÀÎ ÀÎÁõ ¿ë
- };
- typedef struct packet_phase
- {
- BYTE header;
- BYTE phase;
- } TPacketGCPhase;
- typedef struct packet_blank // °ø¹éÆÐŶ.
- {
- BYTE header;
- } TPacketGCBlank;
- typedef struct packet_blank_dynamic
- {
- BYTE header;
- WORD size;
- } TPacketGCBlankDynamic;
- typedef struct packet_header_handshake
- {
- BYTE header;
- DWORD dwHandshake;
- DWORD dwTime;
- LONG lDelta;
- } TPacketGCHandshake;
- typedef struct packet_header_bindudp
- {
- BYTE header;
- DWORD addr;
- WORD port;
- } TPacketGCBindUDP;
- typedef struct packet_header_dynamic_size
- {
- BYTE header;
- WORD size;
- } TDynamicSizePacketHeader;
- typedef struct SSimplePlayerInformation
- {
- DWORD dwID;
- char szName[CHARACTER_NAME_MAX_LEN + 1];
- BYTE byJob;
- BYTE byLevel;
- DWORD dwPlayMinutes;
- BYTE byST, byHT, byDX, byIQ;
- // WORD wParts[CRaceData::PART_MAX_NUM];
- WORD wMainPart;
- BYTE bChangeName;
- WORD wHairPart;
- #ifdef ENABLE_SASH_SYSTEM
- WORD wSashPart;
- #endif
- //BYTE bPrestige;
- BYTE bDummy[4];
- long x, y;
- LONG lAddr;
- WORD wPort;
- BYTE bySkillGroup;
- } TSimplePlayerInformation;
- typedef struct packet_login_success3
- {
- BYTE header;
- TSimplePlayerInformation akSimplePlayerInformation[PLAYER_PER_ACCOUNT3];
- DWORD guild_id[PLAYER_PER_ACCOUNT3];
- char guild_name[PLAYER_PER_ACCOUNT3][GUILD_NAME_MAX_LEN+1];
- DWORD handle;
- DWORD random_key;
- } TPacketGCLoginSuccess3;
- typedef struct packet_login_success4
- {
- BYTE header;
- TSimplePlayerInformation akSimplePlayerInformation[PLAYER_PER_ACCOUNT4];
- DWORD guild_id[PLAYER_PER_ACCOUNT4];
- char guild_name[PLAYER_PER_ACCOUNT4][GUILD_NAME_MAX_LEN+1];
- DWORD handle;
- DWORD random_key;
- } TPacketGCLoginSuccess4;
- enum { LOGIN_STATUS_MAX_LEN = 8 };
- typedef struct packet_login_failure
- {
- BYTE header;
- char szStatus[LOGIN_STATUS_MAX_LEN + 1];
- } TPacketGCLoginFailure;
- typedef struct command_player_create
- {
- BYTE header;
- BYTE index;
- char name[CHARACTER_NAME_MAX_LEN + 1];
- WORD job;
- BYTE shape;
- BYTE CON;
- BYTE INT;
- BYTE STR;
- BYTE DEX;
- } TPacketCGCreateCharacter;
- typedef struct command_player_create_success
- {
- BYTE header;
- BYTE bAccountCharacterSlot;
- TSimplePlayerInformation kSimplePlayerInfomation;
- } TPacketGCPlayerCreateSuccess;
- typedef struct command_create_failure
- {
- BYTE header;
- BYTE bType;
- } TPacketGCCreateFailure;
- typedef struct command_player_delete
- {
- BYTE header;
- BYTE index;
- char szPrivateCode[PRIVATE_CODE_LENGTH];
- } TPacketCGDestroyCharacter;
- typedef struct packet_player_delete_success
- {
- BYTE header;
- BYTE account_index;
- } TPacketGCDestroyCharacterSuccess;
- enum
- {
- ADD_CHARACTER_STATE_DEAD = (1 << 0),
- ADD_CHARACTER_STATE_SPAWN = (1 << 1),
- ADD_CHARACTER_STATE_GUNGON = (1 << 2),
- ADD_CHARACTER_STATE_KILLER = (1 << 3),
- ADD_CHARACTER_STATE_PARTY = (1 << 4),
- };
- enum EPKModes
- {
- PK_MODE_PEACE,
- PK_MODE_REVENGE,
- PK_MODE_FREE,
- PK_MODE_PROTECT,
- PK_MODE_GUILD,
- PK_MODE_MAX_NUM,
- };
- // 2004.11.20.myevan.CRaceData::PART_MAX_NUM »ç¿ë¾ÈÇÏ°Ô ¼öÁ¤ - ¼¹ö¿¡¼ »ç¿ëÇϴ°Ͱú ÀÏÄ¡ÇÏÁö ¾ÊÀ½
- enum ECharacterEquipmentPart
- {
- CHR_EQUIPPART_ARMOR,
- CHR_EQUIPPART_WEAPON,
- CHR_EQUIPPART_HEAD,
- CHR_EQUIPPART_HAIR,
- #ifdef ENABLE_SASH_SYSTEM
- CHR_EQUIPPART_SASH,
- #endif
- CHR_EQUIPPART_NUM,
- };
- #ifdef ENABLE_SHINING_SYSTEM
- enum EShiningParts
- {
- CHR_SHINING_WEAPON_1,
- CHR_SHINING_WEAPON_2,
- CHR_SHINING_WEAPON_3,
- CHR_SHINING_ARMOR_1,
- CHR_SHINING_ARMOR_2,
- CHR_SHINING_SPECIAL,
- CHR_SHINING_NUM,
- };
- #endif
- typedef struct packet_char_additional_info
- {
- BYTE header;
- DWORD dwVID;
- char name[CHARACTER_NAME_MAX_LEN + 1];
- WORD awPart[CHR_EQUIPPART_NUM];
- #ifdef ENABLE_SHINING_SYSTEM
- DWORD adwShining[CHR_SHINING_NUM];
- #endif
- BYTE bEmpire;
- DWORD dwGuildID;
- DWORD dwLevel;
- long sAlignment; //¼±¾ÇÄ¡
- BYTE bPKMode;
- DWORD dwMountVnum;
- #if ENABLE_NEW_PRESTIGE_SYSTEM >= 1
- BYTE bPrestige;
- #endif
- } TPacketGCCharacterAdditionalInfo;
- typedef struct packet_add_char
- {
- BYTE header;
- DWORD dwVID;
- //char name[CHARACTER_NAME_MAX_LEN + 1];
- float angle;
- long x;
- long y;
- long z;
- BYTE bType;
- WORD wRaceNum;
- //WORD awPart[CHR_EQUIPPART_NUM];
- BYTE bMovingSpeed;
- BYTE bAttackSpeed;
- BYTE bStateFlag;
- DWORD dwAffectFlag[2]; // ??
- //BYTE bEmpire;
- //DWORD dwGuild;
- //short sAlignment;
- //BYTE bPKMode;
- //DWORD dwMountVnum;
- } TPacketGCCharacterAdd;
- typedef struct packet_add_char2
- {
- BYTE header;
- DWORD dwVID;
- char name[CHARACTER_NAME_MAX_LEN + 1];
- float angle;
- long x;
- long y;
- long z;
- BYTE bType;
- WORD wRaceNum;
- WORD awPart[CHR_EQUIPPART_NUM];
- BYTE bMovingSpeed;
- BYTE bAttackSpeed;
- BYTE bStateFlag;
- DWORD dwAffectFlag[2]; // ??
- BYTE bEmpire;
- DWORD dwGuild;
- long sAlignment;
- BYTE bPKMode;
- DWORD dwMountVnum;
- } TPacketGCCharacterAdd2;
- typedef struct packet_update_char
- {
- BYTE header;
- DWORD dwVID;
- WORD awPart[CHR_EQUIPPART_NUM];
- #ifdef ENABLE_SHINING_SYSTEM
- DWORD adwShining[CHR_SHINING_NUM];
- #endif
- BYTE bMovingSpeed;
- BYTE bAttackSpeed;
- BYTE bStateFlag;
- DWORD dwAffectFlag[2];
- DWORD dwGuildID;
- long sAlignment;
- BYTE bPKMode;
- DWORD dwMountVnum;
- #if ENABLE_NEW_PRESTIGE_SYSTEM >= 1
- BYTE bPrestige;
- #endif
- } TPacketGCCharacterUpdate;
- typedef struct packet_update_char2
- {
- BYTE header;
- DWORD dwVID;
- WORD awPart[CHR_EQUIPPART_NUM];
- #ifdef ENABLE_SHINING_SYSTEM
- DWORD adwShining[CHR_SHINING_NUM];
- #endif
- BYTE bMovingSpeed;
- BYTE bAttackSpeed;
- BYTE bStateFlag;
- DWORD dwAffectFlag[2];
- DWORD dwGuildID;
- long sAlignment;
- BYTE bPKMode;
- DWORD dwMountVnum;
- } TPacketGCCharacterUpdate2;
- typedef struct packet_del_char
- {
- BYTE header;
- DWORD dwVID;
- } TPacketGCCharacterDelete;
- typedef struct packet_GlobalTime
- {
- BYTE header;
- float GlobalTime;
- } TPacketGCGlobalTime;
- enum EChatType
- {
- CHAT_TYPE_TALKING, /* ±×³É äÆà */
- CHAT_TYPE_INFO, /* Á¤º¸ (¾ÆÀÌÅÛÀ» Áý¾ú´Ù, °æÇèÄ¡¸¦ ¾ò¾ú´Ù. µî) */
- CHAT_TYPE_NOTICE, /* °øÁö»çÇ× */
- CHAT_TYPE_PARTY, /* ÆÄƼ¸» */
- CHAT_TYPE_GUILD, /* ±æµå¸» */
- CHAT_TYPE_COMMAND, /* ¸í·É */
- CHAT_TYPE_SHOUT, /* ¿ÜÄ¡±â */
- CHAT_TYPE_WHISPER, // ¼¹ö¿Í´Â ¿¬µ¿µÇÁö ¾Ê´Â Only Client Enum
- CHAT_TYPE_BIG_NOTICE,
- CHAT_TYPE_MAX_NUM,
- };
- typedef struct packet_chatting
- {
- BYTE header;
- WORD size;
- BYTE type;
- DWORD dwVID;
- BYTE bEmpire;
- } TPacketGCChat;
- typedef struct packet_whisper // °¡º¯ ÆÐŶ
- {
- BYTE bHeader;
- WORD wSize;
- BYTE bType;
- char szNameFrom[CHARACTER_NAME_MAX_LEN + 1];
- } TPacketGCWhisper;
- typedef struct packet_stun
- {
- BYTE header;
- DWORD vid;
- } TPacketGCStun;
- typedef struct packet_dead
- {
- BYTE header;
- DWORD vid;
- } TPacketGCDead;
- typedef struct packet_main_character
- {
- BYTE header;
- DWORD dwVID;
- WORD wRaceNum;
- char szName[CHARACTER_NAME_MAX_LEN + 1];
- long lX, lY, lZ;
- BYTE bySkillGroup;
- } TPacketGCMainCharacter;
- // SUPPORT_BGM
- typedef struct packet_main_character2_empire
- {
- BYTE header;
- DWORD dwVID;
- WORD wRaceNum;
- char szName[CHARACTER_NAME_MAX_LEN + 1];
- long lX, lY, lZ;
- BYTE byEmpire;
- BYTE bySkillGroup;
- } TPacketGCMainCharacter2_EMPIRE;
- typedef struct packet_main_character3_bgm
- {
- enum
- {
- MUSIC_NAME_MAX_LEN = 24,
- };
- BYTE header;
- DWORD dwVID;
- WORD wRaceNum;
- char szUserName[CHARACTER_NAME_MAX_LEN + 1];
- char szBGMName[MUSIC_NAME_MAX_LEN + 1];
- long lX, lY, lZ;
- BYTE byEmpire;
- BYTE bySkillGroup;
- } TPacketGCMainCharacter3_BGM;
- typedef struct packet_main_character4_bgm_vol
- {
- enum
- {
- MUSIC_NAME_MAX_LEN = 24,
- };
- BYTE header;
- DWORD dwVID;
- WORD wRaceNum;
- char szUserName[CHARACTER_NAME_MAX_LEN + 1];
- char szBGMName[MUSIC_NAME_MAX_LEN + 1];
- float fBGMVol;
- long lX, lY, lZ;
- BYTE byEmpire;
- BYTE bySkillGroup;
- } TPacketGCMainCharacter4_BGM_VOL;
- // END_OF_SUPPORT_BGM
- enum EPointTypes
- {
- POINT_NONE, // 0
- POINT_LEVEL, // 1
- POINT_VOICE, // 2
- POINT_EXP, // 3
- POINT_NEXT_EXP, // 4
- POINT_HP, // 5
- POINT_MAX_HP, // 6
- POINT_SP, // 7
- POINT_MAX_SP, // 8
- POINT_STAMINA, // 9 ½ºÅ׹̳Ê
- POINT_MAX_STAMINA, // 10 ÃÖ´ë ½ºÅ׹̳Ê
- POINT_GOLD, // 11
- POINT_ST, // 12 ±Ù·Â
- POINT_HT, // 13 ü·Â
- POINT_DX, // 14 ¹Îø¼º
- POINT_IQ, // 15 Á¤½Å·Â
- POINT_ATT_POWER, // 16 °ø°Ý·Â
- POINT_ATT_SPEED, // 17 °ø°Ý¼Óµµ
- POINT_EVADE_RATE, // 18 ȸÇÇÀ²
- POINT_MOV_SPEED, // 19 À̵¿¼Óµµ
- POINT_DEF_GRADE, // 20 ¹æ¾îµî±Þ
- POINT_CASTING_SPEED, // 21 ÁÖ¹®¼Óµµ (Äð´Ù¿îŸÀÓ*100) / (100 + ÀÌ°ª) = ÃÖÁ¾ Äð´Ù¿î ŸÀÓ
- POINT_MAGIC_ATT_GRADE, // 22 ¸¶¹ý°ø°Ý·Â
- POINT_MAGIC_DEF_GRADE, // 23 ¸¶¹ý¹æ¾î·Â
- POINT_EMPIRE_POINT, // 24 Á¦±¹Á¡¼ö
- POINT_LEVEL_STEP, // 25 ÇÑ ·¹º§¿¡¼ÀÇ ´Ü°è.. (1 2 3 µÉ ¶§ º¸»ó, 4 µÇ¸é ·¹º§ ¾÷)
- POINT_STAT, // 26 ´É·ÂÄ¡ ¿Ã¸± ¼ö ÀÖ´Â °³¼ö
- POINT_SUB_SKILL, // 27 º¸Á¶ ½ºÅ³ Æ÷ÀÎÆ®
- POINT_SKILL, // 28 ¾×Ƽºê ½ºÅ³ Æ÷ÀÎÆ®
- // POINT_SKILL_PASV, // 27 ÆÐ½Ãºê ±â¼ú ¿Ã¸± ¼ö ÀÖ´Â °³¼ö
- // POINT_SKILL_ACTIVE, // 28 ¾×Ƽºê ½ºÅ³ Æ÷ÀÎÆ®
- POINT_MIN_ATK, // 29 ÃÖ¼Ò Æı«·Â
- POINT_MAX_ATK, // 30 ÃÖ´ë Æı«·Â
- POINT_PLAYTIME, // 31 Ç÷¹À̽ð£
- POINT_HP_REGEN, // 32 HP ȸº¹·ü
- POINT_SP_REGEN, // 33 SP ȸº¹·ü
- POINT_BOW_DISTANCE, // 34 È° »çÁ¤°Å¸® Áõ°¡Ä¡ (meter)
- POINT_HP_RECOVERY, // 35 ü·Â ȸº¹ Áõ°¡·®
- POINT_SP_RECOVERY, // 36 Á¤½Å·Â ȸº¹ Áõ°¡·®
- POINT_POISON_PCT, // 37 µ¶ È®·ü
- POINT_STUN_PCT, // 38 ±âÀý È®·ü
- POINT_SLOW_PCT, // 39 ½½·Î¿ì È®·ü
- POINT_CRITICAL_PCT, // 40 Å©¸®Æ¼Äà Ȯ·ü
- POINT_PENETRATE_PCT, // 41 °üÅëŸ°Ý È®·ü
- POINT_CURSE_PCT, // 42 ÀúÁÖ È®·ü
- POINT_ATTBONUS_HUMAN, // 43 Àΰ£¿¡°Ô °ÇÔ
- POINT_ATTBONUS_ANIMAL, // 44 µ¿¹°¿¡°Ô µ¥¹ÌÁö % Áõ°¡
- POINT_ATTBONUS_ORC, // 45 ¿õ±Í¿¡°Ô µ¥¹ÌÁö % Áõ°¡
- POINT_ATTBONUS_MILGYO, // 46 ¹Ð±³¿¡°Ô µ¥¹ÌÁö % Áõ°¡
- POINT_ATTBONUS_UNDEAD, // 47 ½Ãü¿¡°Ô µ¥¹ÌÁö % Áõ°¡
- POINT_ATTBONUS_DEVIL, // 48 ¸¶±Í(¾Ç¸¶)¿¡°Ô µ¥¹ÌÁö % Áõ°¡
- POINT_ATTBONUS_INSECT, // 49 ¹ú·¹Á·
- POINT_ATTBONUS_FIRE, // 50 È¿°Á·
- POINT_ATTBONUS_ICE, // 51 ºù¼³Á·
- POINT_ATTBONUS_DESERT, // 52 »ç¸·Á·
- POINT_ATTBONUS_UNUSED0, // 53 UNUSED0
- POINT_ATTBONUS_UNUSED1, // 54 UNUSED1
- POINT_ATTBONUS_UNUSED2, // 55 UNUSED2
- POINT_ATTBONUS_UNUSED3, // 56 UNUSED3
- POINT_ATTBONUS_UNUSED4, // 57 UNUSED4
- POINT_ATTBONUS_UNUSED5, // 58 UNUSED5
- POINT_ATTBONUS_UNUSED6, // 59 UNUSED6
- POINT_ATTBONUS_UNUSED7, // 60 UNUSED7
- POINT_ATTBONUS_UNUSED8, // 61 UNUSED8
- POINT_ATTBONUS_UNUSED9, // 62 UNUSED9
- POINT_STEAL_HP, // 63 »ý¸í·Â Èí¼ö
- POINT_STEAL_SP, // 64 Á¤½Å·Â Èí¼ö
- POINT_MANA_BURN_PCT, // 65 ¸¶³ª ¹ø
- /// ÇÇÇؽà º¸³Ê½º ///
- POINT_DAMAGE_SP_RECOVER, // 66 °ø°Ý´çÇÒ ½Ã Á¤½Å·Â ȸº¹ È®·ü
- POINT_BLOCK, // 67 ºí·°À²
- POINT_DODGE, // 68 ȸÇÇÀ²
- POINT_RESIST_SWORD, // 69
- POINT_RESIST_TWOHAND, // 70
- POINT_RESIST_DAGGER, // 71
- POINT_RESIST_BELL, // 72
- POINT_RESIST_FAN, // 73
- POINT_RESIST_BOW, // 74 È»ì ÀúÇ× : ´ë¹ÌÁö °¨¼Ò
- POINT_RESIST_FIRE, // 75 È¿° ÀúÇ× : È¿°°ø°Ý¿¡ ´ëÇÑ ´ë¹ÌÁö °¨¼Ò
- POINT_RESIST_ELEC, // 76 Àü±â ÀúÇ× : Àü±â°ø°Ý¿¡ ´ëÇÑ ´ë¹ÌÁö °¨¼Ò
- POINT_RESIST_MAGIC, // 77 ¼ú¹ý ÀúÇ× : ¸ðµç¼ú¹ý¿¡ ´ëÇÑ ´ë¹ÌÁö °¨¼Ò
- POINT_RESIST_WIND, // 78 ¹Ù¶÷ ÀúÇ× : ¹Ù¶÷°ø°Ý¿¡ ´ëÇÑ ´ë¹ÌÁö °¨¼Ò
- POINT_REFLECT_MELEE, // 79 °ø°Ý ¹Ý»ç
- /// Ư¼ö ÇÇÇؽà ///
- POINT_REFLECT_CURSE, // 80 ÀúÁÖ ¹Ý»ç
- POINT_POISON_REDUCE, // 81 µ¶µ¥¹ÌÁö °¨¼Ò
- /// Àû ¼Ò¸ê½Ã ///
- POINT_KILL_SP_RECOVER, // 82 Àû ¼Ò¸ê½Ã MP ȸº¹
- POINT_EXP_DOUBLE_BONUS, // 83
- POINT_GOLD_DOUBLE_BONUS, // 84
- POINT_ITEM_DROP_BONUS, // 85
- /// ȸº¹ °ü·Ã ///
- POINT_POTION_BONUS, // 86
- POINT_KILL_HP_RECOVER, // 87
- POINT_IMMUNE_STUN, // 88
- POINT_IMMUNE_SLOW, // 89
- POINT_IMMUNE_FALL, // 90
- //////////////////
- POINT_PARTY_ATT_GRADE, // 91
- POINT_PARTY_DEF_GRADE, // 92
- POINT_ATT_BONUS, // 93
- POINT_DEF_BONUS, // 94
- POINT_ATT_GRADE_BONUS, // 95
- POINT_DEF_GRADE_BONUS, // 96
- POINT_MAGIC_ATT_GRADE_BONUS, // 97
- POINT_MAGIC_DEF_GRADE_BONUS, // 98
- POINT_RESIST_NORMAL_DAMAGE, // 99
- POINT_STAT_RESET_COUNT = 112,
- POINT_HORSE_SKILL = 113,
- POINT_MALL_ATTBONUS, // 114 °ø°Ý·Â +x%
- POINT_MALL_DEFBONUS, // 115 ¹æ¾î·Â +x%
- POINT_MALL_EXPBONUS, // 116 °æÇèÄ¡ +x%
- POINT_MALL_ITEMBONUS, // 117 ¾ÆÀÌÅÛ µå·ÓÀ² x/10¹è
- POINT_MALL_GOLDBONUS, // 118 µ· µå·ÓÀ² x/10¹è
- POINT_MAX_HP_PCT, // 119 ÃÖ´ë»ý¸í·Â +x%
- POINT_MAX_SP_PCT, // 120 ÃÖ´ëÁ¤½Å·Â +x%
- POINT_SKILL_DAMAGE_BONUS, // 121 ½ºÅ³ µ¥¹ÌÁö *(100+x)%
- POINT_NORMAL_HIT_DAMAGE_BONUS, // 122 ÆòŸ µ¥¹ÌÁö *(100+x)%
- POINT_SKILL_DEFEND_BONUS, // 123 ½ºÅ³ ¹æ¾î µ¥¹ÌÁö
- POINT_NORMAL_HIT_DEFEND_BONUS, // 124 ÆòŸ ¹æ¾î µ¥¹ÌÁö
- POINT_PC_BANG_EXP_BONUS, // 125
- POINT_PC_BANG_DROP_BONUS, // 126 PC¹æ Àü¿ë µå·Ó·ü º¸³Ê½º
- POINT_ENERGY = 128, // 128 ±â·Â
- // ±â·Â ui ¿ë.
- // ÀÌ·¸°Ô ÇÏ°í ½ÍÁö ¾Ê¾ÒÁö¸¸,
- // uiTaskBar¿¡¼´Â affect¿¡ Á¢±ÙÇÒ ¼ö ¾ø°í,
- // ´õ±¸³ª Ŭ¶ó¸®¾ðÆ®¿¡¼´Â blend_affect´Â °ü¸®ÇÏÁö ¾Ê¾Æ,
- // Àӽ÷ΠÀÌ·¸°Ô µÐ´Ù.
- POINT_ENERGY_END_TIME = 129, // 129 ±â·Â Á¾·á ½Ã°£
- // Ŭ¶óÀ̾ðÆ® Æ÷ÀÎÆ®
- POINT_MIN_WEP = 200,
- POINT_MAX_WEP,
- POINT_MIN_MAGIC_WEP,
- POINT_MAX_MAGIC_WEP,
- POINT_HIT_RATE,
- //POINT_MAX_NUM = 255,=>stdafx.h ·Î/
- };
- typedef struct packet_points
- {
- BYTE header;
- long points[POINT_MAX_NUM];
- } TPacketGCPoints;
- typedef struct packet_point_change
- {
- int header;
- DWORD dwVID;
- BYTE Type;
- long amount; // ¹Ù²ï °ª
- long value; // ÇöÀç °ª
- } TPacketGCPointChange;
- typedef struct packet_motion
- {
- BYTE header;
- DWORD vid;
- DWORD victim_vid;
- WORD motion;
- } TPacketGCMotion;
- #if defined(GAIDEN)
- struct TPacketGCItemDelDeprecate
- {
- TPacketGCItemDelDeprecate() :
- header(HEADER_GC_ITEM_DEL),
- pos(0),
- vnum(0),
- count(0)
- {
- memset(&alSockets, 0, sizeof(alSockets));
- memset(&aAttr, 0, sizeof(aAttr));
- }
- BYTE header;
- BYTE pos;
- DWORD vnum;
- BYTE count;
- long alSockets[ITEM_SOCKET_SLOT_MAX_NUM];
- TPlayerItemAttribute aAttr[ITEM_ATTRIBUTE_SLOT_MAX_NUM];
- };
- typedef struct packet_set_item
- {
- BYTE header;
- BYTE pos;
- DWORD vnum;
- BYTE count;
- DWORD flags; // Ç÷¡±× Ãß°¡
- long alSockets[ITEM_SOCKET_SLOT_MAX_NUM];
- TPlayerItemAttribute aAttr[ITEM_ATTRIBUTE_SLOT_MAX_NUM];
- #ifdef ENABLE_CHANGE_LOOK_SYSTEM
- DWORD dwVnum;
- #endif
- } TPacketGCItemSet;
- typedef struct packet_item_del
- {
- BYTE header;
- BYTE pos;
- } TPacketGCItemDel;
- #else
- typedef struct packet_set_item
- {
- BYTE header;
- TItemPos Cell;
- DWORD vnum;
- BYTE count;
- long alSockets[ITEM_SOCKET_SLOT_MAX_NUM];
- TPlayerItemAttribute aAttr[ITEM_ATTRIBUTE_SLOT_MAX_NUM];
- #ifdef ENABLE_CHANGE_LOOK_SYSTEM
- DWORD dwVnum;
- #endif
- } TPacketGCItemSet;
- typedef struct packet_set_item2
- {
- BYTE header;
- TItemPos Cell;
- DWORD vnum;
- WORD count;
- DWORD flags; // Ç÷¡±× Ãß°¡
- DWORD anti_flags; // Ç÷¡±× Ãß°¡
- bool highlight;
- long alSockets[ITEM_SOCKET_SLOT_MAX_NUM];
- TPlayerItemAttribute aAttr[ITEM_ATTRIBUTE_SLOT_MAX_NUM];
- #ifdef ENABLE_CHANGE_LOOK_SYSTEM
- DWORD dwVnum;
- #endif
- } TPacketGCItemSet2;
- #endif
- typedef struct packet_item_del
- {
- BYTE header;
- BYTE pos;
- } TPacketGCItemDel;
- typedef struct packet_use_item
- {
- BYTE header;
- TItemPos Cell;
- DWORD ch_vid;
- DWORD victim_vid;
- DWORD vnum;
- } TPacketGCItemUse;
- typedef struct packet_update_item
- {
- BYTE header;
- TItemPos Cell;
- WORD count;
- long alSockets[ITEM_SOCKET_SLOT_MAX_NUM];
- TPlayerItemAttribute aAttr[ITEM_ATTRIBUTE_SLOT_MAX_NUM];
- #ifdef ENABLE_CHANGE_LOOK_SYSTEM
- DWORD dwVnum;
- #endif
- } TPacketGCItemUpdate;
- typedef struct packet_ground_add_item
- {
- BYTE bHeader;
- long lX;
- long lY;
- long lZ;
- DWORD dwVID;
- DWORD dwVnum;
- } TPacketGCItemGroundAdd;
- typedef struct packet_ground_del_item
- {
- BYTE header;
- DWORD vid;
- } TPacketGCItemGroundDel;
- typedef struct packet_item_ownership
- {
- BYTE bHeader;
- DWORD dwVID;
- char szName[CHARACTER_NAME_MAX_LEN + 1];
- } TPacketGCItemOwnership;
- typedef struct packet_quickslot_add
- {
- BYTE header;
- BYTE pos;
- TQuickSlot slot;
- } TPacketGCQuickSlotAdd;
- typedef struct packet_quickslot_del
- {
- BYTE header;
- BYTE pos;
- } TPacketGCQuickSlotDel;
- typedef struct packet_quickslot_swap
- {
- BYTE header;
- BYTE pos;
- BYTE change_pos;
- } TPacketGCQuickSlotSwap;
- typedef struct packet_shop_start
- {
- struct packet_shop_item items[SHOP_HOST_ITEM_MAX_NUM];
- } TPacketGCShopStart;
- typedef struct packet_shop_start_ex // ´ÙÀ½¿¡ TSubPacketShopTab* shop_tabs ÀÌ µû¶ó¿È.
- {
- typedef struct sub_packet_shop_tab
- {
- char name[SHOP_TAB_NAME_MAX];
- BYTE coin_type;
- packet_shop_item items[SHOP_HOST_ITEM_MAX_NUM];
- } TSubPacketShopTab;
- DWORD owner_vid;
- BYTE shop_tab_count;
- } TPacketGCShopStartEx;
- typedef struct packet_shop_update_item
- {
- BYTE pos;
- struct packet_shop_item item;
- } TPacketGCShopUpdateItem;
- typedef struct packet_shop_update_price
- {
- int iElkAmount;
- } TPacketGCShopUpdatePrice;
- enum EPacketShopSubHeaders
- {
- SHOP_SUBHEADER_GC_START,
- SHOP_SUBHEADER_GC_END,
- SHOP_SUBHEADER_GC_UPDATE_ITEM,
- SHOP_SUBHEADER_GC_UPDATE_PRICE,
- SHOP_SUBHEADER_GC_OK,
- SHOP_SUBHEADER_GC_NOT_ENOUGH_MONEY,
- SHOP_SUBHEADER_GC_SOLDOUT,
- SHOP_SUBHEADER_GC_INVENTORY_FULL,
- SHOP_SUBHEADER_GC_INVALID_POS,
- SHOP_SUBHEADER_GC_SOLD_OUT,
- SHOP_SUBHEADER_GC_START_EX,
- SHOP_SUBHEADER_GC_NOT_ENOUGH_MONEY_EX,
- };
- typedef struct packet_shop
- {
- BYTE header;
- WORD size;
- BYTE subheader;
- } TPacketGCShop;
- typedef struct packet_exchange
- {
- BYTE header;
- BYTE subheader;
- BYTE is_me;
- DWORD arg1;
- TItemPos arg2;
- DWORD arg3;
- long alValues[ITEM_SOCKET_SLOT_MAX_NUM];
- TPlayerItemAttribute aAttr[ITEM_ATTRIBUTE_SLOT_MAX_NUM];
- #ifdef ENABLE_CHANGE_LOOK_SYSTEM
- DWORD dwLookVnum;
- #endif
- } TPacketGCExchange;
- enum
- {
- EXCHANGE_SUBHEADER_GC_START, // arg1 == vid
- EXCHANGE_SUBHEADER_GC_ITEM_ADD, // arg1 == vnum arg2 == pos arg3 == count
- EXCHANGE_SUBHEADER_GC_ITEM_DEL, // arg1 == pos
- EXCHANGE_SUBHEADER_GC_ELK_ADD, // arg1 == elk
- EXCHANGE_SUBHEADER_GC_ACCEPT, // arg1 == accept
- EXCHANGE_SUBHEADER_GC_END, // arg1 == not used
- EXCHANGE_SUBHEADER_GC_ALREADY, // arg1 == not used
- EXCHANGE_SUBHEADER_GC_LESS_ELK, // arg1 == not used
- };
- typedef struct packet_position
- {
- BYTE header;
- DWORD vid;
- BYTE position;
- } TPacketGCPosition;
- typedef struct packet_ping
- {
- BYTE header;
- } TPacketGCPing;
- typedef struct packet_pong
- {
- BYTE bHeader;
- } TPacketCGPong;
- typedef struct packet_script
- {
- BYTE header;
- WORD size;
- BYTE skin;
- WORD src_size;
- } TPacketGCScript;
- typedef struct packet_target
- {
- BYTE header;
- DWORD dwVID;
- BYTE bHPPercent;
- } TPacketGCTarget;
- typedef struct packet_damage_info
- {
- BYTE header;
- DWORD dwVID;
- BYTE flag;
- int damage;
- } TPacketGCDamageInfo;
- typedef struct packet_mount
- {
- BYTE header;
- DWORD vid;
- DWORD mount_vid;
- BYTE pos;
- DWORD _x, _y;
- } TPacketGCMount;
- typedef struct packet_change_speed
- {
- BYTE header;
- DWORD vid;
- WORD moving_speed;
- } TPacketGCChangeSpeed;
- typedef struct packet_move
- {
- BYTE bHeader;
- BYTE bFunc;
- BYTE bArg;
- BYTE bRot;
- DWORD dwVID;
- LONG lX;
- LONG lY;
- DWORD dwTime;
- DWORD dwDuration;
- } TPacketGCMove;
- enum
- {
- QUEST_SEND_IS_BEGIN = 1 << 0,
- QUEST_SEND_TITLE = 1 << 1, // 28ÀÚ ±îÁö
- QUEST_SEND_CLOCK_NAME = 1 << 2, // 16ÀÚ ±îÁö
- QUEST_SEND_CLOCK_VALUE = 1 << 3,
- QUEST_SEND_COUNTER_NAME = 1 << 4, // 16ÀÚ ±îÁö
- QUEST_SEND_COUNTER_VALUE = 1 << 5,
- QUEST_SEND_ICON_FILE = 1 << 6, // 24ÀÚ ±îÁö
- };
- typedef struct packet_quest_info
- {
- BYTE header;
- WORD size;
- WORD index;
- BYTE flag;
- } TPacketGCQuestInfo;
- typedef struct packet_quest_confirm
- {
- BYTE header;
- char msg[64+1];
- long timeout;
- DWORD requestPID;
- } TPacketGCQuestConfirm;
- typedef struct packet_attack
- {
- BYTE header;
- DWORD dwVID;
- DWORD dwVictimVID; // Àû VID
- BYTE bType; // °ø°Ý À¯Çü
- } TPacketGCAttack;
- typedef struct packet_c2c
- {
- BYTE header;
- WORD wSize;
- } TPacketGCC2C;
- typedef struct packetd_sync_position_element
- {
- DWORD dwVID;
- long lX;
- long lY;
- } TPacketGCSyncPositionElement;
- typedef struct packetd_sync_position
- {
- BYTE bHeader;
- WORD wSize;
- } TPacketGCSyncPosition;
- typedef struct packet_ownership
- {
- BYTE bHeader;
- DWORD dwOwnerVID;
- DWORD dwVictimVID;
- } TPacketGCOwnership;
- #define SKILL_MAX_NUM 255
- typedef struct packet_skill_level
- {
- BYTE bHeader;
- BYTE abSkillLevels[SKILL_MAX_NUM];
- } TPacketGCSkillLevel;
- typedef struct SPlayerSkill
- {
- BYTE bMasterType;
- BYTE bLevel;
- time_t tNextRead;
- } TPlayerSkill;
- typedef struct packet_skill_level_new
- {
- BYTE bHeader;
- TPlayerSkill skills[SKILL_MAX_NUM];
- } TPacketGCSkillLevelNew;
- // fly
- typedef struct packet_fly
- {
- BYTE bHeader;
- BYTE bType;
- DWORD dwStartVID;
- DWORD dwEndVID;
- } TPacketGCCreateFly;
- enum EPVPModes
- {
- PVP_MODE_NONE,
- PVP_MODE_AGREE,
- PVP_MODE_FIGHT,
- PVP_MODE_REVENGE,
- };
- typedef struct packet_duel_start
- {
- BYTE header ;
- WORD wSize ; // DWORD°¡ ¸î°³? °³¼ö = (wSize - sizeof(TPacketGCPVPList)) / 4
- } TPacketGCDuelStart ;
- typedef struct packet_pvp
- {
- BYTE header;
- DWORD dwVIDSrc;
- DWORD dwVIDDst;
- BYTE bMode;
- } TPacketGCPVP;
- typedef struct packet_skill_cooltime_end
- {
- BYTE header;
- BYTE bSkill;
- } TPacketGCSkillCoolTimeEnd;
- typedef struct packet_warp
- {
- BYTE bHeader;
- LONG lX;
- LONG lY;
- LONG lAddr;
- WORD wPort;
- } TPacketGCWarp;
- typedef struct packet_party_invite
- {
- BYTE header;
- DWORD leader_pid;
- } TPacketGCPartyInvite;
- typedef struct packet_party_add
- {
- BYTE header;
- DWORD pid;
- char name[CHARACTER_NAME_MAX_LEN+1];
- } TPacketGCPartyAdd;
- typedef struct packet_party_update
- {
- BYTE header;
- DWORD pid;
- BYTE state;
- BYTE percent_hp;
- short affects[PARTY_AFFECT_SLOT_MAX_NUM];
- } TPacketGCPartyUpdate;
- typedef struct packet_party_remove
- {
- BYTE header;
- DWORD pid;
- } TPacketGCPartyRemove;
- typedef TPacketCGSafeboxCheckout TPacketGCSafeboxCheckout;
- typedef TPacketCGSafeboxCheckin TPacketGCSafeboxCheckin;
- typedef struct packet_safebox_wrong_password
- {
- BYTE bHeader;
- } TPacketGCSafeboxWrongPassword;
- typedef struct packet_safebox_size
- {
- BYTE bHeader;
- BYTE bSize;
- } TPacketGCSafeboxSize;
- typedef struct packet_safebox_money_change
- {
- BYTE bHeader;
- DWORD dwMoney;
- } TPacketGCSafeboxMoneyChange;
- typedef struct command_empire
- {
- BYTE bHeader;
- BYTE bEmpire;
- } TPacketCGEmpire;
- typedef struct packet_empire
- {
- BYTE bHeader;
- BYTE bEmpire;
- } TPacketGCEmpire;
- enum
- {
- FISHING_SUBHEADER_GC_START,
- FISHING_SUBHEADER_GC_STOP,
- FISHING_SUBHEADER_GC_REACT,
- FISHING_SUBHEADER_GC_SUCCESS,
- FISHING_SUBHEADER_GC_FAIL,
- FISHING_SUBHEADER_GC_FISH,
- };
- typedef struct packet_fishing
- {
- BYTE header;
- BYTE subheader;
- DWORD info;
- BYTE dir;
- } TPacketGCFishing;
- typedef struct paryt_parameter
- {
- BYTE bHeader;
- BYTE bDistributeMode;
- } TPacketGCPartyParameter;
- //////////////////////////////////////////////////////////////////////////
- // Guild
- enum
- {
- GUILD_SUBHEADER_GC_LOGIN,
- GUILD_SUBHEADER_GC_LOGOUT,
- GUILD_SUBHEADER_GC_LIST,
- GUILD_SUBHEADER_GC_GRADE,
- GUILD_SUBHEADER_GC_ADD,
- GUILD_SUBHEADER_GC_REMOVE,
- GUILD_SUBHEADER_GC_GRADE_NAME,
- GUILD_SUBHEADER_GC_GRADE_AUTH,
- GUILD_SUBHEADER_GC_INFO,
- GUILD_SUBHEADER_GC_COMMENTS,
- GUILD_SUBHEADER_GC_CHANGE_EXP,
- GUILD_SUBHEADER_GC_CHANGE_MEMBER_GRADE,
- GUILD_SUBHEADER_GC_SKILL_INFO,
- GUILD_SUBHEADER_GC_CHANGE_MEMBER_GENERAL,
- GUILD_SUBHEADER_GC_GUILD_INVITE,
- GUILD_SUBHEADER_GC_WAR,
- GUILD_SUBHEADER_GC_GUILD_NAME,
- GUILD_SUBHEADER_GC_GUILD_WAR_LIST,
- GUILD_SUBHEADER_GC_GUILD_WAR_END_LIST,
- GUILD_SUBHEADER_GC_WAR_POINT,
- GUILD_SUBHEADER_GC_MONEY_CHANGE,
- };
- typedef struct packet_guild
- {
- BYTE header;
- WORD size;
- BYTE subheader;
- } TPacketGCGuild;
- // SubHeader - Grade
- enum
- {
- GUILD_AUTH_ADD_MEMBER = (1 << 0),
- GUILD_AUTH_REMOVE_MEMBER = (1 << 1),
- GUILD_AUTH_NOTICE = (1 << 2),
- GUILD_AUTH_SKILL = (1 << 3),
- };
- typedef struct packet_guild_sub_grade
- {
- char grade_name[GUILD_GRADE_NAME_MAX_LEN+1]; // 8+1 ±æµåÀå, ±æµå¿ø µîÀÇ À̸§
- BYTE auth_flag;
- } TPacketGCGuildSubGrade;
- typedef struct packet_guild_sub_member
- {
- DWORD pid;
- BYTE byGrade;
- BYTE byIsGeneral;
- BYTE byJob;
- BYTE byLevel;
- DWORD dwOffer;
- BYTE byNameFlag;
- // if NameFlag is TRUE, name is sent from server.
- // char szName[CHARACTER_ME_MAX_LEN+1];
- } TPacketGCGuildSubMember;
- typedef struct packet_guild_sub_info
- {
- WORD member_count;
- WORD max_member_count;
- DWORD guild_id;
- DWORD master_pid;
- DWORD exp;
- BYTE level;
- char name[GUILD_NAME_MAX_LEN+1];
- DWORD gold;
- BYTE hasLand;
- } TPacketGCGuildInfo;
- enum EGuildWarState
- {
- GUILD_WAR_NONE,
- GUILD_WAR_SEND_DECLARE,
- GUILD_WAR_REFUSE,
- GUILD_WAR_RECV_DECLARE,
- GUILD_WAR_WAIT_START,
- GUILD_WAR_CANCEL,
- GUILD_WAR_ON_WAR,
- GUILD_WAR_END,
- GUILD_WAR_DURATION = 2*60*60, // 2½Ã°£
- };
- typedef struct packet_guild_war
- {
- DWORD dwGuildSelf;
- DWORD dwGuildOpp;
- BYTE bType;
- BYTE bWarState;
- } TPacketGCGuildWar;
- typedef struct SPacketGuildWarPoint
- {
- DWORD dwGainGuildID;
- DWORD dwOpponentGuildID;
- long lPoint;
- } TPacketGuildWarPoint;
- // SubHeader - Dungeon
- enum
- {
- DUNGEON_SUBHEADER_GC_TIME_ATTACK_START = 0,
- DUNGEON_SUBHEADER_GC_DESTINATION_POSITION = 1,
- };
- typedef struct packet_dungeon
- {
- BYTE bHeader;
- WORD size;
- BYTE subheader;
- } TPacketGCDungeon;
- // Private Shop
- typedef struct SPacketGCShopSign
- {
- BYTE bHeader;
- DWORD dwVID;
- char szSign[SHOP_SIGN_MAX_LEN + 1];
- } TPacketGCShopSign;
- typedef struct SPacketGCTime
- {
- BYTE bHeader;
- time_t time;
- } TPacketGCTime;
- enum
- {
- WALKMODE_RUN,
- WALKMODE_WALK,
- };
- typedef struct SPacketGCWalkMode
- {
- BYTE header;
- DWORD vid;
- BYTE mode;
- } TPacketGCWalkMode;
- typedef struct SPacketGCChangeSkillGroup
- {
- BYTE header;
- BYTE skill_group;
- } TPacketGCChangeSkillGroup;
- struct TMaterial
- {
- DWORD vnum;
- DWORD count;
- };
- typedef struct SRefineTable
- {
- DWORD src_vnum;
- DWORD result_vnum;
- BYTE material_count;
- int cost; // ¼Ò¿ä ºñ¿ë
- int prob; // È®·ü
- TMaterial materials[REFINE_MATERIAL_MAX_NUM];
- } TRefineTable;
- typedef struct SPacketGCRefineInformation
- {
- BYTE header;
- BYTE pos;
- TRefineTable refine_table;
- } TPacketGCRefineInformation;
- typedef struct SPacketGCRefineInformationNew
- {
- BYTE header;
- BYTE type;
- BYTE pos;
- TRefineTable refine_table;
- } TPacketGCRefineInformationNew;
- enum SPECIAL_EFFECT
- {
- SE_NONE,
- SE_HPUP_RED,
- SE_SPUP_BLUE,
- SE_SPEEDUP_GREEN,
- SE_DXUP_PURPLE,
- SE_CRITICAL,
- SE_PENETRATE,
- SE_BLOCK,
- SE_DODGE,
- SE_CHINA_FIREWORK,
- SE_SPIN_TOP,
- SE_SUCCESS,
- SE_FAIL,
- SE_FR_SUCCESS,
- SE_LEVELUP_ON_14_FOR_GERMANY, //·¹º§¾÷ 14À϶§ ( µ¶ÀÏÀü¿ë )
- SE_LEVELUP_UNDER_15_FOR_GERMANY,//·¹º§¾÷ 15À϶§ ( µ¶ÀÏÀü¿ë )
- SE_PERCENT_DAMAGE1,
- SE_PERCENT_DAMAGE2,
- SE_PERCENT_DAMAGE3,
- SE_AUTO_HPUP,
- SE_AUTO_SPUP,
- SE_EQUIP_RAMADAN_RING, // Ãʽ´ÞÀÇ ¹ÝÁö¸¦ Âø¿ëÇÏ´Â ¼ø°£¿¡ ¹ßµ¿ÇÏ´Â ÀÌÆåÆ®
- SE_EQUIP_HALLOWEEN_CANDY, // ÇÒ·ÎÀ© »çÅÁÀ» Âø¿ë(-_-;)ÇÑ ¼ø°£¿¡ ¹ßµ¿ÇÏ´Â ÀÌÆåÆ®
- SE_EQUIP_HAPPINESS_RING, // Å©¸®½º¸¶½º ÇູÀÇ ¹ÝÁö¸¦ Âø¿ëÇÏ´Â ¼ø°£¿¡ ¹ßµ¿ÇÏ´Â ÀÌÆåÆ®
- SE_EQUIP_LOVE_PENDANT, // ¹ß·»Å¸ÀÎ »ç¶ûÀÇ ÆÒ´øÆ®(71145) Âø¿ëÇÒ ¶§ ÀÌÆåÆ® (¹ßµ¿ÀÌÆåÆ®ÀÓ, Áö¼ÓÀÌÆåÆ® ¾Æ´Ô)
- #ifdef ENABLE_SASH_SYSTEM
- SE_EFFECT_SASH_SUCCEDED,
- SE_EFFECT_SASH_EQUIP,
- #endif
- };
- typedef struct SPacketGCSpecialEffect
- {
- BYTE header;
- BYTE type;
- DWORD vid;
- } TPacketGCSpecialEffect;
- typedef struct SPacketGCNPCPosition
- {
- BYTE header;
- WORD size;
- WORD count;
- } TPacketGCNPCPosition;
- struct TNPCPosition
- {
- BYTE bType;
- char name[CHARACTER_NAME_MAX_LEN+1];
- long x;
- long y;
- };
- typedef struct SPacketGCChangeName
- {
- BYTE header;
- DWORD pid;
- char name[CHARACTER_NAME_MAX_LEN+1];
- } TPacketGCChangeName;
- enum EBlockAction
- {
- BLOCK_EXCHANGE = (1 << 0),
- BLOCK_PARTY_INVITE = (1 << 1),
- BLOCK_GUILD_INVITE = (1 << 2),
- BLOCK_WHISPER = (1 << 3),
- BLOCK_MESSENGER_INVITE = (1 << 4),
- BLOCK_PARTY_REQUEST = (1 << 5),
- };
- typedef struct packet_china_matrixd_card
- {
- BYTE bHeader;
- DWORD dwRows;
- DWORD dwCols;
- } TPacketGCChinaMatrixCard;
- typedef struct packet_runup_matrixd_quiz
- {
- BYTE bHeader;
- char szQuiz[RUNUP_MATRIX_QUIZ_MAX_LEN + 1];
- } TPacketGCRunupMatrixQuiz;
- typedef struct packet_newcibn_passpod_request
- {
- BYTE bHeader;
- } TPacketGCNEWCIBNPasspodRequest;
- typedef struct packet_newcibn_passpod_failure
- {
- BYTE bHeader;
- char szMessage[NEWCIBN_PASSPOD_FAILURE_MAX_LEN + 1];
- } TPacketGCNEWCIBNPasspodFailure;
- typedef struct packet_login_key
- {
- BYTE bHeader;
- DWORD dwLoginKey;
- } TPacketGCLoginKey;
- typedef struct packet_auth_success
- {
- BYTE bHeader;
- DWORD dwLoginKey;
- BYTE bResult;
- } TPacketGCAuthSuccess;
- typedef struct packet_auth_success_openid
- {
- BYTE bHeader;
- DWORD dwLoginKey;
- BYTE bResult;
- char login[ID_MAX_NUM + 1];
- } TPacketGCAuthSuccessOpenID;
- typedef struct packet_channel
- {
- BYTE header;
- BYTE channel;
- } TPacketGCChannel;
- typedef struct SEquipmentItemSet
- {
- DWORD vnum;
- WORD count;
- long alSockets[ITEM_SOCKET_SLOT_MAX_NUM];
- TPlayerItemAttribute aAttr[ITEM_ATTRIBUTE_SLOT_MAX_NUM];
- } TEquipmentItemSet;
- typedef struct pakcet_view_equip
- {
- BYTE header;
- DWORD dwVID;
- TEquipmentItemSet equips[WEAR_MAX_NUM];
- } TPacketGCViewEquip;
- typedef struct
- {
- DWORD dwID;
- long x, y;
- long width, height;
- DWORD dwGuildID;
- } TLandPacketElement;
- typedef struct packet_land_list
- {
- BYTE header;
- WORD size;
- } TPacketGCLandList;
- typedef struct
- {
- BYTE bHeader;
- long lID;
- char szTargetName[32+1];
- } TPacketGCTargetCreate;
- enum
- {
- CREATE_TARGET_TYPE_NONE,
- CREATE_TARGET_TYPE_LOCATION,
- CREATE_TARGET_TYPE_CHARACTER,
- };
- typedef struct
- {
- BYTE bHeader;
- long lID;
- char szTargetName[32+1];
- DWORD dwVID;
- BYTE byType;
- } TPacketGCTargetCreateNew;
- typedef struct
- {
- BYTE bHeader;
- long lID;
- long lX, lY;
- } TPacketGCTargetUpdate;
- typedef struct
- {
- BYTE bHeader;
- long lID;
- } TPacketGCTargetDelete;
- typedef struct
- {
- DWORD dwType;
- BYTE bPointIdxApplyOn;
- long lApplyValue;
- DWORD dwFlag;
- long lDuration;
- long lSPCost;
- } TPacketAffectElement;
- typedef struct
- {
- BYTE bHeader;
- TPacketAffectElement elem;
- } TPacketGCAffectAdd;
- typedef struct
- {
- BYTE bHeader;
- DWORD dwType;
- BYTE bApplyOn;
- } TPacketGCAffectRemove;
- typedef struct packet_mall_open
- {
- BYTE bHeader;
- BYTE bSize;
- } TPacketGCMallOpen;
- typedef struct packet_lover_info
- {
- BYTE bHeader;
- char szName[CHARACTER_NAME_MAX_LEN + 1];
- BYTE byLovePoint;
- } TPacketGCLoverInfo;
- typedef struct packet_love_point_update
- {
- BYTE bHeader;
- BYTE byLovePoint;
- } TPacketGCLovePointUpdate;
- typedef struct packet_dig_motion
- {
- BYTE header;
- DWORD vid;
- DWORD target_vid;
- BYTE count;
- } TPacketGCDigMotion;
- typedef struct SPacketGCOnTime
- {
- BYTE header;
- int ontime; // sec
- } TPacketGCOnTime;
- typedef struct SPacketGCResetOnTime
- {
- BYTE header;
- } TPacketGCResetOnTime;
- typedef struct SPacketGCPanamaPack
- {
- BYTE bHeader;
- char szPackName[256];
- BYTE abIV[32];
- } TPacketGCPanamaPack;
- typedef struct SPacketGCHybridCryptKeys
- {
- private:
- SPacketGCHybridCryptKeys() : m_pStream(NULL) {}
- public:
- SPacketGCHybridCryptKeys(int iStreamSize) : iKeyStreamLen(iStreamSize)
- {
- m_pStream = new BYTE[iStreamSize];
- }
- ~SPacketGCHybridCryptKeys()
- {
- if( m_pStream )
- {
- delete[] m_pStream;
- m_pStream = NULL;
- }
- }
- static int GetFixedHeaderSize()
- {
- return sizeof(BYTE)+sizeof(WORD)+sizeof(int);
- }
- BYTE bHeader;
- WORD wDynamicPacketSize;
- int iKeyStreamLen;
- BYTE* m_pStream;
- } TPacketGCHybridCryptKeys;
- typedef struct SPacketGCHybridSDB
- {
- private:
- SPacketGCHybridSDB() : m_pStream(NULL) {}
- public:
- SPacketGCHybridSDB(int iStreamSize) : iSDBStreamLen(iStreamSize)
- {
- m_pStream = new BYTE[iStreamSize];
- }
- ~SPacketGCHybridSDB()
- {
- delete[] m_pStream;
- m_pStream = NULL;
- }
- static int GetFixedHeaderSize()
- {
- return sizeof(BYTE)+sizeof(WORD)+sizeof(int);
- }
- BYTE bHeader;
- WORD wDynamicPacketSize;
- int iSDBStreamLen;
- BYTE* m_pStream;
- } TPacketGCHybridSDB;
- /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- // Client To Client
- typedef struct packet_state
- {
- BYTE bHeader;
- BYTE bFunc;
- BYTE bArg;
- BYTE bRot;
- DWORD dwVID;
- DWORD dwTime;
- TPixelPosition kPPos;
- } TPacketCCState;
- typedef struct packet_hs_check_req
- {
- BYTE bHeader;
- AHNHS_TRANS_BUFFER Req;
- } TPacketHSCheck;
- //NOTE : recv/send¿¡ °øÅëÀ¸·Î »ý±è, bPacketDataÀÇ ³»¿ë¸¸ ¹Ù²ï´Ù.
- typedef struct packet_xtrap_verify
- {
- BYTE bHeader;
- BYTE bPacketData[128];
- } TPacketXTrapCSVerify;
- // AUTOBAN
- typedef struct packet_autoban_quiz
- {
- BYTE bHeader;
- BYTE bDuration;
- BYTE bCaptcha[64*32];
- char szQuiz[256];
- } TPacketGCAutoBanQuiz;
- // END_OF_AUTOBAN
- #ifdef _IMPROVED_PACKET_ENCRYPTION_
- struct TPacketKeyAgreement
- {
- static const int MAX_DATA_LEN = 256;
- BYTE bHeader;
- WORD wAgreedLength;
- WORD wDataLength;
- BYTE data[MAX_DATA_LEN];
- };
- struct TPacketKeyAgreementCompleted
- {
- BYTE bHeader;
- BYTE data[3]; // dummy (not used)
- };
- #endif // _IMPROVED_PACKET_ENCRYPTION_
- #ifdef __AUCTION__
- // ArgumentÀÇ ¿ëµµ´Â cmd¿¡ µû¶ó ´Ù¸£´Ù.
- typedef struct SPacketCGAuctionCmd
- {
- BYTE bHeader;
- BYTE cmd;
- int arg1;
- int arg2;
- int arg3;
- int arg4;
- } TPacketCGAuctionCmd;
- typedef struct SPacketGCAuctionItemListPack
- {
- BYTE bHeader;
- BYTE bNumbers;
- } TPacketGCAuctionItemListPack;
- #endif
- typedef struct SPacketGCSpecificEffect
- {
- BYTE header;
- DWORD vid;
- char effect_file[128];
- } TPacketGCSpecificEffect;
- // ¿ëÈ¥¼®
- enum EDragonSoulRefineWindowRefineType
- {
- DragonSoulRefineWindow_UPGRADE,
- DragonSoulRefineWindow_IMPROVEMENT,
- DragonSoulRefineWindow_REFINE,
- };
- enum EPacketCGDragonSoulSubHeaderType
- {
- DS_SUB_HEADER_OPEN,
- DS_SUB_HEADER_CLOSE,
- DS_SUB_HEADER_DO_UPGRADE,
- DS_SUB_HEADER_DO_IMPROVEMENT,
- DS_SUB_HEADER_DO_REFINE,
- DS_SUB_HEADER_REFINE_FAIL,
- DS_SUB_HEADER_REFINE_FAIL_MAX_REFINE,
- DS_SUB_HEADER_REFINE_FAIL_INVALID_MATERIAL,
- DS_SUB_HEADER_REFINE_FAIL_NOT_ENOUGH_MONEY,
- DS_SUB_HEADER_REFINE_FAIL_NOT_ENOUGH_MATERIAL,
- DS_SUB_HEADER_REFINE_FAIL_TOO_MUCH_MATERIAL,
- DS_SUB_HEADER_REFINE_SUCCEED,
- };
- typedef struct SPacketCGDragonSoulRefine
- {
- SPacketCGDragonSoulRefine() : header (HEADER_CG_DRAGON_SOUL_REFINE)
- {}
- BYTE header;
- BYTE bSubType;
- TItemPos ItemGrid[DS_REFINE_WINDOW_MAX_NUM];
- } TPacketCGDragonSoulRefine;
- typedef struct SPacketGCDragonSoulRefine
- {
- SPacketGCDragonSoulRefine() : header(HEADER_GC_DRAGON_SOUL_REFINE)
- {}
- BYTE header;
- BYTE bSubType;
- TItemPos Pos;
- } TPacketGCDragonSoulRefine;
- typedef struct SChannelStatus
- {
- short nPort;
- BYTE bStatus;
- } TChannelStatus;
- #ifdef ENABLE_SASH_SYSTEM
- enum ESashInfo
- {
- SASH_ABSORPTION_SOCKET = 0,
- SASH_ABSORBED_SOCKET = 1,
- SASH_CLEAN_ATTR_VALUE0 = 7,
- SASH_WINDOW_MAX_MATERIALS = 2,
- };
- enum
- {
- HEADER_CG_SASH = 211,
- HEADER_GC_SASH = 215,
- SASH_SUBHEADER_GC_OPEN = 0,
- SASH_SUBHEADER_GC_CLOSE,
- SASH_SUBHEADER_GC_ADDED,
- SASH_SUBHEADER_GC_REMOVED,
- SASH_SUBHEADER_CG_REFINED,
- SASH_SUBHEADER_CG_CLOSE = 0,
- SASH_SUBHEADER_CG_ADD,
- SASH_SUBHEADER_CG_REMOVE,
- SASH_SUBHEADER_CG_REFINE,
- };
- typedef struct SPacketSash
- {
- BYTE header;
- BYTE subheader;
- bool bWindow;
- DWORD dwPrice;
- BYTE bPos;
- TItemPos tPos;
- DWORD dwItemVnum;
- DWORD dwMinAbs;
- DWORD dwMaxAbs;
- } TPacketSash;
- typedef struct SSashMaterial
- {
- BYTE bHere;
- WORD wCell;
- } TSashMaterial;
- typedef struct SSashResult
- {
- DWORD dwItemVnum;
- DWORD dwMinAbs;
- DWORD dwMaxAbs;
- } TSashResult;
- #endif
- #pragma pack(pop)
Server Side
length.h
- #ifndef __INC_METIN_II_LENGTH_H__
- #define __INC_METIN_II_LENGTH_H__
- #define WORD_MAX 0xffff
- enum EMisc
- {
- MAX_HOST_LENGTH = 15,
- IP_ADDRESS_LENGTH = 15,
- LOGIN_MAX_LEN = 30,
- PASSWD_MAX_LEN = 16,
- PLAYER_PER_ACCOUNT = 4,
- ACCOUNT_STATUS_MAX_LEN = 8,
- CHARACTER_NAME_MAX_LEN = 24,
- SHOP_SIGN_MAX_LEN = 32,
- INVENTORY_MAX_NUM = 180,
- ABILITY_MAX_NUM = 50,
- EMPIRE_MAX_NUM = 4,
- BANWORD_MAX_LEN = 24,
- SMS_MAX_LEN = 80,
- MOBILE_MAX_LEN = 32,
- SOCIAL_ID_MAX_LEN = 18,
- GUILD_NAME_MAX_LEN = 12,
- SHOP_HOST_ITEM_MAX_NUM = 40, /* È£½ºÆ®ÀÇ ÃÖ´ë ¾ÆÀÌÅÛ °³¼ö */
- SHOP_GUEST_ITEM_MAX_NUM = 18, /* °Ô½ºÆ®ÀÇ ÃÖ´ë ¾ÆÀÌÅÛ °³¼ö */
- SHOP_PRICELIST_MAX_NUM = 40, ///< °³ÀλóÁ¡ °¡°ÝÁ¤º¸ ¸®½ºÆ®¿¡¼ À¯ÁöÇÒ °¡°ÝÁ¤º¸ÀÇ ÃÖ´ë °¹¼ö
- CHAT_MAX_LEN = 512,
- QUICKSLOT_MAX_NUM = 36,
- JOURNAL_MAX_NUM = 2,
- QUERY_MAX_LEN = 8192,
- FILE_MAX_LEN = 128,
- PLAYER_EXP_TABLE_MAX = 150,
- PLAYER_MAX_LEVEL_CONST = 150,
- GUILD_MAX_LEVEL = 20,
- MOB_MAX_LEVEL = 100,
- ATTRIBUTE_MAX_VALUE = 20,
- CHARACTER_PATH_MAX_NUM = 64,
- SKILL_MAX_NUM = 255,
- SKILLBOOK_DELAY_MIN = 64800,
- SKILLBOOK_DELAY_MAX = 108000,
- SKILL_MAX_LEVEL = 40,
- APPLY_NAME_MAX_LEN = 32,
- EVENT_FLAG_NAME_MAX_LEN = 32,
- MOB_SKILL_MAX_NUM = 5,
- POINT_MAX_NUM = 255,
- DRAGON_SOUL_BOX_SIZE = 32,
- DRAGON_SOUL_BOX_COLUMN_NUM = 8,
- DRAGON_SOUL_BOX_ROW_NUM = DRAGON_SOUL_BOX_SIZE / DRAGON_SOUL_BOX_COLUMN_NUM,
- DRAGON_SOUL_REFINE_GRID_SIZE = 15,
- MAX_AMOUNT_OF_MALL_BONUS = 20,
- WEAR_MAX_NUM = 32,
- //LIMIT_GOLD
- GOLD_MAX = 2000000000,
- MAX_PASSPOD = 8 ,
- //END_LIMIT_GOLD
- OPENID_AUTHKEY_LEN = 32,
- SHOP_TAB_NAME_MAX = 32,
- SHOP_TAB_COUNT_MAX = 3,
- BELT_INVENTORY_SLOT_WIDTH = 4,
- BELT_INVENTORY_SLOT_HEIGHT= 4,
- BELT_INVENTORY_SLOT_COUNT = BELT_INVENTORY_SLOT_WIDTH * BELT_INVENTORY_SLOT_HEIGHT,
- /**
- **** ÇöÀç±îÁö ÇÒ´ç µÈ ¾ÆÀÌÅÛ ¿µ¿ª Á¤¸® (DB»ó Item Position) ****
- +------------------------------------------------------+ 0
- | ij¸¯ÅÍ ±âº» Àκ¥Å丮 (45Ä * 2ÆäÀÌÁö) 90Ä |
- +------------------------------------------------------+ 90 = INVENTORY_MAX_NUM(90)
- | ij¸¯ÅÍ Àåºñ â (Âø¿ëÁßÀÎ ¾ÆÀÌÅÛ) 32Ä |
- +------------------------------------------------------+ 122 = INVENTORY_MAX_NUM(90) + WEAR_MAX_NUM(32)
- | ¿ëÈ¥¼® Àåºñ â (Âø¿ëÁßÀÎ ¿ëÈ¥¼®) 12Ä |
- +------------------------------------------------------+ 134 = 122 + DS_SLOT_MAX(6) * DRAGON_SOUL_DECK_MAX_NUM(2)
- | ¿ëÈ¥¼® Àåºñ â ¿¹¾à (¾ÆÁ÷ ¹Ì»ç¿ë) 18Ä |
- +------------------------------------------------------+ 152 = 134 + DS_SLOT_MAX(6) * DRAGON_SOUL_DECK_RESERVED_MAX_NUM(3)
- | º§Æ® Àκ¥Å丮 (º§Æ® Âø¿ë½Ã¿¡¸¸ º§Æ® ·¹º§¿¡ µû¶ó È°¼º)|
- +------------------------------------------------------+ 168 = 152 + BELT_INVENTORY_SLOT_COUNT(16) = INVENTORY_AND_EQUIP_CELL_MAX
- | ¹Ì»ç¿ë |
- +------------------------------------------------------+ ??
- */
- };
- enum EMatrixCard
- {
- MATRIX_CODE_MAX_LEN = 192,
- MATRIX_ANSWER_MAX_LEN = 8,
- };
- enum EWearPositions
- {
- WEAR_BODY, // 0
- WEAR_HEAD, // 1
- WEAR_FOOTS, // 2
- WEAR_WRIST, // 3
- WEAR_WEAPON, // 4
- WEAR_NECK, // 5
- WEAR_EAR, // 6
- WEAR_UNIQUE1, // 7
- WEAR_UNIQUE2, // 8
- WEAR_ARROW, // 9
- WEAR_SHIELD, // 10
- WEAR_ABILITY1, // 11
- WEAR_ABILITY2, // 12
- WEAR_ABILITY3, // 13
- WEAR_ABILITY4, // 14
- WEAR_ABILITY5, // 15
- WEAR_ABILITY6, // 16
- WEAR_ABILITY7, // 17
- WEAR_ABILITY8, // 18
- WEAR_COSTUME_BODY, // 19
- WEAR_COSTUME_HAIR, // 20
- WEAR_RING1, // 21 : ½Å±Ô ¹ÝÁö½½·Ô1 (¿ÞÂÊ)
- WEAR_RING2, // 22 : ½Å±Ô ¹ÝÁö½½·Ô2 (¿À¸¥ÂÊ)
- WEAR_BELT, // 23 : ½Å±Ô º§Æ®½½·Ô
- #ifdef __ITEM_SHINING__
- WEAR_SHINING_WEAPON_1 = 26, //26
- WEAR_SHINING_WEAPON_2, //27
- WEAR_SHINING_WEAPON_3, //28
- WEAR_SHINING_ARMOR_1, //29
- WEAR_SHINING_ARMOR_2, //30
- WEAR_SHINING_SPECIAL, //31
- #endif
- WEAR_COSTUME_SASH = 32, // 21
- WEAR_MAX = 34 //
- };
- enum EDragonSoulDeckType
- {
- DRAGON_SOUL_DECK_0,
- DRAGON_SOUL_DECK_1,
- DRAGON_SOUL_DECK_MAX_NUM = 2,
- DRAGON_SOUL_DECK_RESERVED_MAX_NUM = 3, // NOTE: Áß¿ä! ¾ÆÁ÷ »ç¿ëÁßÀÌÁø ¾ÊÁö¸¸, 3ÆäÀÌÁö ºÐ·®À» ¿¹¾à ÇØ µÒ. DS DECKÀ» ´Ã¸± °æ¿ì ¹Ýµå½Ã ±× ¼ö¸¸Å RESERVED¿¡¼ Â÷°¨ÇØ¾ß ÇÔ!
- };
- enum ESex
- {
- SEX_MALE,
- SEX_FEMALE
- };
- enum EDirection
- {
- DIR_NORTH,
- DIR_NORTHEAST,
- DIR_EAST,
- DIR_SOUTHEAST,
- DIR_SOUTH,
- DIR_SOUTHWEST,
- DIR_WEST,
- DIR_NORTHWEST,
- DIR_MAX_NUM
- };
- #define ABILITY_MAX_LEVEL 10 /* ±â¼ú ÃÖ´ë ·¹º§ */
- enum EAbilityDifficulty
- {
- DIFFICULTY_EASY,
- DIFFICULTY_NORMAL,
- DIFFICULTY_HARD,
- DIFFICULTY_VERY_HARD,
- DIFFICULTY_NUM_TYPES
- };
- enum EAbilityCategory
- {
- CATEGORY_PHYSICAL, /* ½ÅüÀû ¾îºô¸®Æ¼ */
- CATEGORY_MENTAL, /* Á¤½ÅÀû ¾îºô¸®Æ¼ */
- CATEGORY_ATTRIBUTE, /* ´É·Â ¾îºô¸®Æ¼ */
- CATEGORY_NUM_TYPES
- };
- enum EJobs
- {
- JOB_WARRIOR,
- JOB_ASSASSIN,
- JOB_SURA,
- JOB_SHAMAN,
- JOB_MAX_NUM
- };
- enum ESkillGroups
- {
- SKILL_GROUP_MAX_NUM = 2,
- };
- enum ERaceFlags
- {
- RACE_FLAG_ANIMAL = (1 << 0),
- RACE_FLAG_UNDEAD = (1 << 1),
- RACE_FLAG_DEVIL = (1 << 2),
- RACE_FLAG_HUMAN = (1 << 3),
- RACE_FLAG_ORC = (1 << 4),
- RACE_FLAG_MILGYO = (1 << 5),
- RACE_FLAG_INSECT = (1 << 6),
- RACE_FLAG_FIRE = (1 << 7),
- RACE_FLAG_ICE = (1 << 8),
- RACE_FLAG_DESERT = (1 << 9),
- RACE_FLAG_TREE = (1 << 10),
- RACE_FLAG_ATT_ELEC = (1 << 11),
- RACE_FLAG_ATT_FIRE = (1 << 12),
- RACE_FLAG_ATT_ICE = (1 << 13),
- RACE_FLAG_ATT_WIND = (1 << 14),
- RACE_FLAG_ATT_EARTH = (1 << 15),
- RACE_FLAG_ATT_DARK = (1 << 16),
- };
- enum ELoads
- {
- LOAD_NONE,
- LOAD_LIGHT,
- LOAD_NORMAL,
- LOAD_HEAVY,
- LOAD_MASSIVE
- };
- enum
- {
- QUICKSLOT_TYPE_NONE,
- QUICKSLOT_TYPE_ITEM,
- QUICKSLOT_TYPE_SKILL,
- QUICKSLOT_TYPE_COMMAND,
- QUICKSLOT_TYPE_MAX_NUM,
- };
- enum EParts
- {
- PART_MAIN,
- PART_WEAPON,
- PART_HEAD,
- PART_HAIR,
- PART_SASH = 5,
- PART_MAX_NUM,
- PART_WEAPON_SUB,
- };
- enum EChatType
- {
- CHAT_TYPE_TALKING, /* ±×³É äÆà */
- CHAT_TYPE_INFO, /* Á¤º¸ (¾ÆÀÌÅÛÀ» Áý¾ú´Ù, °æÇèÄ¡¸¦ ¾ò¾ú´Ù. µî) */
- CHAT_TYPE_NOTICE, /* °øÁö»çÇ× */
- CHAT_TYPE_PARTY, /* ÆÄƼ¸» */
- CHAT_TYPE_GUILD, /* ±æµå¸» */
- CHAT_TYPE_COMMAND, /* ÀÏ¹Ý ¸í·É */
- CHAT_TYPE_SHOUT, /* ¿ÜÄ¡±â */
- CHAT_TYPE_WHISPER,
- CHAT_TYPE_BIG_NOTICE,
- CHAT_TYPE_MONARCH_NOTICE,
- CHAT_TYPE_MAX_NUM
- };
- enum EWhisperType
- {
- WHISPER_TYPE_NORMAL = 0,
- WHISPER_TYPE_NOT_EXIST = 1,
- WHISPER_TYPE_TARGET_BLOCKED = 2,
- WHISPER_TYPE_SENDER_BLOCKED = 3,
- WHISPER_TYPE_ERROR = 4,
- WHISPER_TYPE_GM = 5,
- WHISPER_TYPE_SYSTEM = 0xFF
- };
- enum ECharacterPosition
- {
- POSITION_GENERAL,
- POSITION_BATTLE,
- POSITION_DYING,
- POSITION_SITTING_CHAIR,
- POSITION_SITTING_GROUND,
- POSITION_INTRO,
- POSITION_MAX_NUM
- };
- enum EGMLevels
- {
- GM_PLAYER,
- GM_LOW_WIZARD,
- GM_WIZARD,
- GM_HIGH_WIZARD,
- GM_GOD,
- GM_IMPLEMENTOR
- };
- enum EMobRank
- {
- MOB_RANK_PAWN,
- MOB_RANK_S_PAWN,
- MOB_RANK_KNIGHT,
- MOB_RANK_S_KNIGHT,
- MOB_RANK_BOSS,
- MOB_RANK_KING,
- MOB_RANK_MAX_NUM
- };
- enum ECharType
- {
- CHAR_TYPE_MONSTER,
- CHAR_TYPE_NPC,
- CHAR_TYPE_STONE,
- CHAR_TYPE_WARP,
- CHAR_TYPE_DOOR,
- CHAR_TYPE_BUILDING,
- CHAR_TYPE_PC,
- CHAR_TYPE_POLYMORPH_PC,
- CHAR_TYPE_HORSE,
- CHAR_TYPE_GOTO
- };
- enum EBattleType
- {
- BATTLE_TYPE_MELEE,
- BATTLE_TYPE_RANGE,
- BATTLE_TYPE_MAGIC,
- BATTLE_TYPE_SPECIAL,
- BATTLE_TYPE_POWER,
- BATTLE_TYPE_TANKER,
- BATTLE_TYPE_SUPER_POWER,
- BATTLE_TYPE_SUPER_TANKER,
- BATTLE_TYPE_MAX_NUM
- };
- enum EApplyTypes
- {
- APPLY_NONE, // 0
- APPLY_MAX_HP, // 1
- APPLY_MAX_SP, // 2
- APPLY_CON, // 3
- APPLY_INT, // 4
- APPLY_STR, // 5
- APPLY_DEX, // 6
- APPLY_ATT_SPEED, // 7
- APPLY_MOV_SPEED, // 8
- APPLY_CAST_SPEED, // 9
- APPLY_HP_REGEN, // 10
- APPLY_SP_REGEN, // 11
- APPLY_POISON_PCT, // 12
- APPLY_STUN_PCT, // 13
- APPLY_SLOW_PCT, // 14
- APPLY_CRITICAL_PCT, // 15
- APPLY_PENETRATE_PCT, // 16
- APPLY_ATTBONUS_HUMAN, // 17
- APPLY_ATTBONUS_ANIMAL, // 18
- APPLY_ATTBONUS_ORC, // 19
- APPLY_ATTBONUS_MILGYO, // 20
- APPLY_ATTBONUS_UNDEAD, // 21
- APPLY_ATTBONUS_DEVIL, // 22
- APPLY_STEAL_HP, // 23
- APPLY_STEAL_SP, // 24
- APPLY_MANA_BURN_PCT, // 25
- APPLY_DAMAGE_SP_RECOVER, // 26
- APPLY_BLOCK, // 27
- APPLY_DODGE, // 28
- APPLY_RESIST_SWORD, // 29
- APPLY_RESIST_TWOHAND, // 30
- APPLY_RESIST_DAGGER, // 31
- APPLY_RESIST_BELL, // 32
- APPLY_RESIST_FAN, // 33
- APPLY_RESIST_BOW, // 34
- APPLY_RESIST_FIRE, // 35
- APPLY_RESIST_ELEC, // 36
- APPLY_RESIST_MAGIC, // 37
- APPLY_RESIST_WIND, // 38
- APPLY_REFLECT_MELEE, // 39
- APPLY_REFLECT_CURSE, // 40
- APPLY_POISON_REDUCE, // 41
- APPLY_KILL_SP_RECOVER, // 42
- APPLY_EXP_DOUBLE_BONUS, // 43
- APPLY_GOLD_DOUBLE_BONUS, // 44
- APPLY_ITEM_DROP_BONUS, // 45
- APPLY_POTION_BONUS, // 46
- APPLY_KILL_HP_RECOVER, // 47
- APPLY_IMMUNE_STUN, // 48
- APPLY_IMMUNE_SLOW, // 49
- APPLY_IMMUNE_FALL, // 50
- APPLY_SKILL, // 51
- APPLY_BOW_DISTANCE, // 52
- APPLY_ATT_GRADE_BONUS, // 53
- APPLY_DEF_GRADE_BONUS, // 54
- APPLY_MAGIC_ATT_GRADE, // 55
- APPLY_MAGIC_DEF_GRADE, // 56
- APPLY_CURSE_PCT, // 57
- APPLY_MAX_STAMINA, // 58
- APPLY_ATTBONUS_WARRIOR, // 59
- APPLY_ATTBONUS_ASSASSIN, // 60
- APPLY_ATTBONUS_SURA, // 61
- APPLY_ATTBONUS_SHAMAN, // 62
- APPLY_ATTBONUS_MONSTER, // 63
- APPLY_MALL_ATTBONUS, // 64 °ø°Ý·Â +x%
- APPLY_MALL_DEFBONUS, // 65 ¹æ¾î·Â +x%
- APPLY_MALL_EXPBONUS, // 66 °æÇèÄ¡ +x%
- APPLY_MALL_ITEMBONUS, // 67 ¾ÆÀÌÅÛ µå·ÓÀ² x/10¹è
- APPLY_MALL_GOLDBONUS, // 68 µ· µå·ÓÀ² x/10¹è
- APPLY_MAX_HP_PCT, // 69 ÃÖ´ë »ý¸í·Â +x%
- APPLY_MAX_SP_PCT, // 70 ÃÖ´ë Á¤½Å·Â +x%
- APPLY_SKILL_DAMAGE_BONUS, // 71 ½ºÅ³ µ¥¹ÌÁö * (100+x)%
- APPLY_NORMAL_HIT_DAMAGE_BONUS, // 72 ÆòŸ µ¥¹ÌÁö * (100+x)%
- APPLY_SKILL_DEFEND_BONUS, // 73 ½ºÅ³ µ¥¹ÌÁö ¹æ¾î * (100-x)%
- APPLY_NORMAL_HIT_DEFEND_BONUS, // 74 ÆòŸ µ¥¹ÌÁö ¹æ¾î * (100-x)%
- APPLY_PC_BANG_EXP_BONUS, // 75 PC¹æ ¾ÆÀÌÅÛ EXP º¸³Ê½º
- APPLY_PC_BANG_DROP_BONUS, // 76 PC¹æ ¾ÆÀÌÅÛ µå·ÓÀ² º¸³Ê½º
- APPLY_EXTRACT_HP_PCT, // 77 »ç¿ë½Ã HP ¼Ò¸ð
- APPLY_RESIST_WARRIOR, // 78 ¹«»ç¿¡°Ô ÀúÇ×
- APPLY_RESIST_ASSASSIN, // 79 ÀÚ°´¿¡°Ô ÀúÇ×
- APPLY_RESIST_SURA, // 80 ¼ö¶ó¿¡°Ô ÀúÇ×
- APPLY_RESIST_SHAMAN, // 81 ¹«´ç¿¡°Ô ÀúÇ×
- APPLY_ENERGY, // 82 ±â·Â
- APPLY_DEF_GRADE, // 83 ¹æ¾î·Â. DEF_GRADE_BONUS´Â Ŭ¶ó¿¡¼ µÎ¹è·Î º¸¿©Áö´Â ÀǵµµÈ ¹ö±×(...)°¡ ÀÖ´Ù.
- APPLY_COSTUME_ATTR_BONUS, // 84 ÄÚ½ºÆ¬ ¾ÆÀÌÅÛ¿¡ ºÙÀº ¼Ó¼ºÄ¡ º¸³Ê½º
- APPLY_MAGIC_ATTBONUS_PER, // 85 ¸¶¹ý °ø°Ý·Â +x%
- APPLY_MELEE_MAGIC_ATTBONUS_PER, // 86 ¸¶¹ý + ¹Ð¸® °ø°Ý·Â +x%
- APPLY_RESIST_ICE, // 87 ³Ã±â ÀúÇ×
- APPLY_RESIST_EARTH, // 88 ´ëÁö ÀúÇ×
- APPLY_RESIST_DARK, // 89 ¾îµÒ ÀúÇ×
- APPLY_ANTI_CRITICAL_PCT, //90 Å©¸®Æ¼Äà ÀúÇ×
- APPLY_ANTI_PENETRATE_PCT, //91 °üÅëŸ°Ý ÀúÇ×
- MAX_APPLY_NUM, //
- };
- enum EOnClickEvents
- {
- ON_CLICK_NONE,
- ON_CLICK_SHOP,
- ON_CLICK_TALK,
- ON_CLICK_MAX_NUM
- };
- enum EOnIdleEvents
- {
- ON_IDLE_NONE,
- ON_IDLE_GENERAL,
- ON_IDLE_MAX_NUM
- };
- enum EWindows
- {
- RESERVED_WINDOW,
- INVENTORY,
- EQUIPMENT,
- SAFEBOX,
- MALL,
- DRAGON_SOUL_INVENTORY,
- BELT_INVENTORY,
- #ifdef __AUCTION__
- AUCTION,
- #endif
- GROUND
- };
- enum EMobSizes
- {
- MOBSIZE_RESERVED,
- MOBSIZE_SMALL,
- MOBSIZE_MEDIUM,
- MOBSIZE_BIG
- };
- enum EAIFlags
- {
- AIFLAG_AGGRESSIVE = (1 << 0),
- AIFLAG_NOMOVE = (1 << 1),
- AIFLAG_COWARD = (1 << 2),
- AIFLAG_NOATTACKSHINSU = (1 << 3),
- AIFLAG_NOATTACKJINNO = (1 << 4),
- AIFLAG_NOATTACKCHUNJO = (1 << 5),
- AIFLAG_ATTACKMOB = (1 << 6 ),
- AIFLAG_BERSERK = (1 << 7),
- AIFLAG_STONESKIN = (1 << 8),
- AIFLAG_GODSPEED = (1 << 9),
- AIFLAG_DEATHBLOW = (1 << 10),
- AIFLAG_REVIVE = (1 << 11),
- };
- enum EMobStatType
- {
- MOB_STATTYPE_POWER,
- MOB_STATTYPE_TANKER,
- MOB_STATTYPE_SUPER_POWER,
- MOB_STATTYPE_SUPER_TANKER,
- MOB_STATTYPE_RANGE,
- MOB_STATTYPE_MAGIC,
- MOB_STATTYPE_MAX_NUM
- };
- enum EImmuneFlags
- {
- IMMUNE_STUN = (1 << 0),
- IMMUNE_SLOW = (1 << 1),
- IMMUNE_FALL = (1 << 2),
- IMMUNE_CURSE = (1 << 3),
- IMMUNE_POISON = (1 << 4),
- IMMUNE_TERROR = (1 << 5),
- IMMUNE_REFLECT = (1 << 6),
- };
- enum EMobEnchants
- {
- MOB_ENCHANT_CURSE,
- MOB_ENCHANT_SLOW,
- MOB_ENCHANT_POISON,
- MOB_ENCHANT_STUN,
- MOB_ENCHANT_CRITICAL,
- MOB_ENCHANT_PENETRATE,
- MOB_ENCHANTS_MAX_NUM
- };
- enum EMobResists
- {
- MOB_RESIST_SWORD,
- MOB_RESIST_TWOHAND,
- MOB_RESIST_DAGGER,
- MOB_RESIST_BELL,
- MOB_RESIST_FAN,
- MOB_RESIST_BOW,
- MOB_RESIST_FIRE,
- MOB_RESIST_ELECT,
- MOB_RESIST_MAGIC,
- MOB_RESIST_WIND,
- MOB_RESIST_POISON,
- MOB_RESISTS_MAX_NUM
- };
- enum
- {
- SKILL_ATTR_TYPE_NORMAL = 1,
- SKILL_ATTR_TYPE_MELEE,
- SKILL_ATTR_TYPE_RANGE,
- SKILL_ATTR_TYPE_MAGIC
- /*
- SKILL_ATTR_TYPE_FIRE,
- SKILL_ATTR_TYPE_ICE,
- SKILL_ATTR_TYPE_ELEC,
- SKILL_ATTR_TYPE_DARK,
- */
- };
- enum
- {
- SKILL_NORMAL,
- SKILL_MASTER,
- SKILL_GRAND_MASTER,
- SKILL_PERFECT_MASTER,
- };
- enum EGuildWarType
- {
- GUILD_WAR_TYPE_FIELD,
- GUILD_WAR_TYPE_BATTLE,
- GUILD_WAR_TYPE_FLAG,
- GUILD_WAR_TYPE_MAX_NUM
- };
- enum EGuildWarState
- {
- GUILD_WAR_NONE,
- GUILD_WAR_SEND_DECLARE,
- GUILD_WAR_REFUSE,
- GUILD_WAR_RECV_DECLARE,
- GUILD_WAR_WAIT_START,
- GUILD_WAR_CANCEL,
- GUILD_WAR_ON_WAR,
- GUILD_WAR_END,
- GUILD_WAR_OVER,
- GUILD_WAR_RESERVE,
- GUILD_WAR_DURATION = 30*60, // 1½Ã°£
- GUILD_WAR_WIN_POINT = 1000,
- GUILD_WAR_LADDER_HALF_PENALTY_TIME = 12*60*60,
- };
- enum EAttributeSet
- {
- ATTRIBUTE_SET_WEAPON,
- ATTRIBUTE_SET_BODY,
- ATTRIBUTE_SET_WRIST,
- ATTRIBUTE_SET_FOOTS,
- ATTRIBUTE_SET_NECK,
- ATTRIBUTE_SET_HEAD,
- ATTRIBUTE_SET_SHIELD,
- ATTRIBUTE_SET_EAR,
- ATTRIBUTE_SET_MAX_NUM
- };
- enum EPrivType
- {
- PRIV_NONE,
- PRIV_ITEM_DROP,
- PRIV_GOLD_DROP,
- PRIV_GOLD10_DROP,
- PRIV_EXP_PCT,
- MAX_PRIV_NUM,
- };
- enum EMoneyLogType
- {
- MONEY_LOG_RESERVED,
- MONEY_LOG_MONSTER,
- MONEY_LOG_SHOP,
- MONEY_LOG_REFINE,
- MONEY_LOG_QUEST,
- MONEY_LOG_GUILD,
- MONEY_LOG_MISC,
- MONEY_LOG_MONSTER_KILL,
- MONEY_LOG_DROP,
- MONEY_LOG_TYPE_MAX_NUM,
- };
- enum EPremiumTypes
- {
- PREMIUM_EXP, // °æÇèÄ¡°¡ 1.2¹è
- PREMIUM_ITEM, // ¾ÆÀÌÅÛ µå·ÓÀ²ÀÌ 2¹è
- PREMIUM_SAFEBOX, // â°í°¡ 1Ä¿¡¼ 3Ä
- PREMIUM_AUTOLOOT, // µ· ÀÚµ¿ Áݱâ
- PREMIUM_FISH_MIND, // °í±Þ ¹°°í±â ³¬ÀÏ È®·ü »ó½Â
- PREMIUM_MARRIAGE_FAST, // ±Ý½Ç Áõ°¡ ¾çÀ» ºü¸£°ÔÇÕ´Ï´Ù.
- PREMIUM_GOLD, // µ· µå·ÓÀ²ÀÌ 1.5¹è
- PREMIUM_MAX_NUM = 9
- };
- enum SPECIAL_EFFECT
- {
- SE_NONE,
- SE_HPUP_RED,
- SE_SPUP_BLUE,
- SE_SPEEDUP_GREEN,
- SE_DXUP_PURPLE,
- SE_CRITICAL,
- SE_PENETRATE,
- SE_BLOCK,
- SE_DODGE,
- SE_CHINA_FIREWORK,
- SE_SPIN_TOP,
- SE_SUCCESS,
- SE_FAIL,
- SE_FR_SUCCESS,
- SE_LEVELUP_ON_14_FOR_GERMANY,
- SE_LEVELUP_UNDER_15_FOR_GERMANY,
- SE_PERCENT_DAMAGE1,
- SE_PERCENT_DAMAGE2,
- SE_PERCENT_DAMAGE3,
- SE_AUTO_HPUP,
- SE_AUTO_SPUP,
- SE_EQUIP_RAMADAN_RING, // ¶ó¸¶´Ü Ãʽ´ÞÀÇ ¹ÝÁö(71135) Âø¿ëÇÒ ¶§ ÀÌÆåÆ® (¹ßµ¿ÀÌÆåÆ®ÀÓ, Áö¼ÓÀÌÆåÆ® ¾Æ´Ô)
- SE_EQUIP_HALLOWEEN_CANDY, // ÇÒ·ÎÀ© »çÅÁÀ» Âø¿ë(-_-;)ÇÑ ¼ø°£¿¡ ¹ßµ¿ÇÏ´Â ÀÌÆåÆ®
- SE_EQUIP_HAPPINESS_RING, // Å©¸®½º¸¶½º ÇູÀÇ ¹ÝÁö(71143) Âø¿ëÇÒ ¶§ ÀÌÆåÆ® (¹ßµ¿ÀÌÆåÆ®ÀÓ, Áö¼ÓÀÌÆåÆ® ¾Æ´Ô)
- SE_EQUIP_LOVE_PENDANT, // ¹ß·»Å¸ÀÎ »ç¶ûÀÇ ÆÒ´øÆ®(71145) Âø¿ëÇÒ ¶§ ÀÌÆåÆ® (¹ßµ¿ÀÌÆåÆ®ÀÓ, Áö¼ÓÀÌÆåÆ® ¾Æ´Ô)
- #ifdef __SASH_SYSTEM__
- SE_EFFECT_SASH_SUCCEDED,
- SE_EFFECT_SASH_EQUIP,
- #endif
- SE_TECHSTUFE_UP,
- } ;
- enum EItemBuffConfig
- {
- //first item resist buff config
- MASTER_RESIST_BLESS_ITEM_BUFF_VNUM = 79003,
- MASTER_RESIST_BLESS_AFFECT_VALUE = 24,
- MASTER_RESIST_BLESS_AFFECT_TIME_VALUE = 160,
- MASTER_RESIST_BLESS_USINGS = 80,
- // end of first item resist buff config
- //secound item resist buff config
- GRAND_RESIST_BLESS_ITEM_BUFF_VNUM = 79004,
- GRAND_RESIST_BLESS_AFFECT_VALUE = 29,
- GRAND_RESIST_BLESS_AFFECT_TIME_VALUE = 224,
- GRAND_RESIST_BLESS_USINGS = 60,
- //end of second item resist buff config
- //third item resist buff config
- PERFECT_RESIST_BLESS_ITEM_BUFF_VNUM = 79005,
- PERFECT_RESIST_BLESS_AFFECT_VALUE = 35,
- PERFECT_RESIST_BLESS_AFFECT_TIME_VALUE = 310,
- PERFECT_RESIST_BLESS_USINGS = 50,
- //end of third item resist buff config
- //first item critical buff config
- MASTER_CRITICAL_BLESS_ITEM_BUFF_VNUM = 79006,
- MASTER_CRITICAL_BLESS_AFFECT_VALUE = 24,
- MASTER_CRITICAL_BLESS_AFFECT_TIME_VALUE = 110,
- MASTER_CRITICAL_BLESS_USINGS = 80,
- //end of first item critical buff config
- //secound item critical buff config
- GRAND_CRITICAL_BLESS_ITEM_BUFF_VNUM = 79007,
- GRAND_CRITICAL_BLESS_AFFECT_VALUE = 29,
- GRAND_CRITICAL_BLESS_AFFECT_TIME_VALUE = 142,
- GRAND_CRITICAL_BLESS_USINGS = 60,
- //end of secound item critical buff config
- //third item critical buff config
- PERFECT_CRITICAL_BLESS_ITEM_BUFF_VNUM = 79008,
- PERFECT_CRITICAL_BLESS_AFFECT_VALUE = 35,
- PERFECT_CRITICAL_BLESS_AFFECT_TIME_VALUE = 185,
- PERFECT_CRITICAL_BLESS_USINGS = 50,
- //end of third item critical buff config
- //first item reflection buff config
- MASTER_REFLECT_BLESS_ITEM_BUFF_VNUM = 79000,
- MASTER_REFLECT_BLESS_AFFECT_VALUE = 21,
- MASTER_REFLECT_BLESS_AFFECT_TIME_VALUE = 160,
- MASTER_REFLECT_BLESS_USINGS = 80,
- //end of first item reflection buff config
- //secound item reflection buff config
- GRAND_REFLECT_BLESS_ITEM_BUFF_VNUM = 79001,
- GRAND_REFLECT_BLESS_AFFECT_VALUE = 31,
- GRAND_REFLECT_BLESS_AFFECT_TIME_VALUE = 224,
- GRAND_REFLECT_BLESS_USINGS = 60,
- //end of secound item reflection buff config
- //third item reflection buff config
- PERFECT_REFLECT_BLESS_ITEM_BUFF_VNUM = 79002,
- PERFECT_REFLECT_BLESS_AFFECT_VALUE = 45,
- PERFECT_REFLECT_BLESS_AFFECT_TIME_VALUE = 310,
- PERFECT_REFLECT_BLESS_USINGS = 50,
- //end of third item reflection buff config
- };
- enum ETeenFlags
- {
- TEENFLAG_NONE = 0,
- TEENFLAG_1HOUR,
- TEENFLAG_2HOUR,
- TEENFLAG_3HOUR,
- TEENFLAG_4HOUR,
- TEENFLAG_5HOUR,
- };
- #include "item_length.h"
- // inventoryÀÇ positionÀ» ³ªÅ¸³»´Â ±¸Á¶Ã¼
- // int¿ÍÀÇ ¾Ï½ÃÀû Çüº¯È¯ÀÌ ÀÖ´Â ÀÌÀ¯´Â,
- // Àκ¥ °ü·ÃµÈ ¸ðµç ÇÔ¼ö°¡ window_typeÀº ¹ÞÁö ¾Ê°í, cell Çϳª¸¸ ¹Þ¾Ò±â ¶§¹®¿¡,(±âÁ¸¿¡´Â Àκ¥ÀÌ Çϳª »ÓÀÌ¾î¼ inventory typeÀ̶õ°Ô ÇÊ¿ä¾ø¾ú±â ¶§¹®¿¡,)
- // Àκ¥ °ü·Ã ¸ðµç ÇÔ¼ö È£ÃâºÎºÐÀ» ¼öÁ¤ÇÏ´Â °ÍÀÌ ³°¨Çϱ⠋š¹®ÀÌ´Ù.
- enum EDragonSoulRefineWindowSize
- {
- DRAGON_SOUL_REFINE_GRID_MAX = 15,
- };
- enum EMisc2
- {
- DRAGON_SOUL_EQUIP_SLOT_START = INVENTORY_MAX_NUM + WEAR_MAX_NUM,
- DRAGON_SOUL_EQUIP_SLOT_END = DRAGON_SOUL_EQUIP_SLOT_START + (DS_SLOT_MAX * DRAGON_SOUL_DECK_MAX_NUM),
- DRAGON_SOUL_EQUIP_RESERVED_SLOT_END = DRAGON_SOUL_EQUIP_SLOT_END + (DS_SLOT_MAX * DRAGON_SOUL_DECK_RESERVED_MAX_NUM),
- BELT_INVENTORY_SLOT_START = DRAGON_SOUL_EQUIP_RESERVED_SLOT_END,
- BELT_INVENTORY_SLOT_END = BELT_INVENTORY_SLOT_START + BELT_INVENTORY_SLOT_COUNT,
- INVENTORY_AND_EQUIP_SLOT_MAX = BELT_INVENTORY_SLOT_END,
- };
- #pragma pack(push, 1)
- typedef struct SItemPos
- {
- BYTE window_type;
- WORD cell;
- SItemPos ()
- {
- window_type = INVENTORY;
- cell = WORD_MAX;
- }
- SItemPos (BYTE _window_type, WORD _cell)
- {
- window_type = _window_type;
- cell = _cell;
- }
- bool IsValidItemPosition() const
- {
- switch (window_type)
- {
- case RESERVED_WINDOW:
- return false;
- case INVENTORY:
- case EQUIPMENT:
- case BELT_INVENTORY:
- return cell < INVENTORY_AND_EQUIP_SLOT_MAX;
- case DRAGON_SOUL_INVENTORY:
- return cell < (DRAGON_SOUL_INVENTORY_MAX_NUM);
- // µ¿ÀûÀ¸·Î Å©±â°¡ Á¤ÇØÁö´Â window´Â valid üũ¸¦ ÇÒ ¼ö°¡ ¾ø´Ù.
- case SAFEBOX:
- case MALL:
- return false;
- default:
- return false;
- }
- return false;
- }
- bool IsEquipPosition() const
- {
- return ((INVENTORY == window_type || EQUIPMENT == window_type) && cell >= INVENTORY_MAX_NUM && cell < INVENTORY_MAX_NUM + WEAR_MAX_NUM)
- || IsDragonSoulEquipPosition();
- }
- bool IsDragonSoulEquipPosition() const
- {
- return (DRAGON_SOUL_EQUIP_SLOT_START <= cell) && (DRAGON_SOUL_EQUIP_SLOT_END > cell);
- }
- bool IsBeltInventoryPosition() const
- {
- return (BELT_INVENTORY_SLOT_START <= cell) && (BELT_INVENTORY_SLOT_END > cell);
- }
- bool IsDefaultInventoryPosition() const
- {
- return INVENTORY == window_type && cell < INVENTORY_MAX_NUM;
- }
- bool operator==(const struct SItemPos& rhs) const
- {
- return (window_type == rhs.window_type) && (cell == rhs.cell);
- }
- bool operator<(const struct SItemPos& rhs) const
- {
- return (window_type < rhs.window_type) || ((window_type == rhs.window_type) && (cell < rhs.cell));
- }
- } TItemPos;
- const TItemPos NPOS (RESERVED_WINDOW, WORD_MAX);
- typedef enum
- {
- SHOP_COIN_TYPE_GOLD, // DEFAULT VALUE
- SHOP_COIN_TYPE_SECONDARY_COIN,
- } EShopCoinType;
- #pragma pack(pop)
- #endif
packet.h
- #ifndef __INC_PACKET_H__
- #define __INC_PACKET_H__
- enum
- {
- HEADER_CG_HANDSHAKE = 0xff,
- HEADER_CG_PONG = 0xfe,
- HEADER_CG_TIME_SYNC = 0xfc,
- HEADER_CG_KEY_AGREEMENT = 0xfb, // _IMPROVED_PACKET_ENCRYPTION_
- HEADER_CG_LOGIN = 1,
- HEADER_CG_ATTACK = 2,
- HEADER_CG_CHAT = 3,
- HEADER_CG_CHARACTER_CREATE = 4,
- HEADER_CG_CHARACTER_DELETE = 5,
- HEADER_CG_CHARACTER_SELECT = 6,
- HEADER_CG_MOVE = 7,
- HEADER_CG_SYNC_POSITION = 8,
- HEADER_CG_ENTERGAME = 10,
- HEADER_CG_ITEM_USE = 11,
- HEADER_CG_ITEM_DROP = 12,
- HEADER_CG_ITEM_MOVE = 13,
- HEADER_CG_ITEM_PICKUP = 15,
- HEADER_CG_QUICKSLOT_ADD = 16,
- HEADER_CG_QUICKSLOT_DEL = 17,
- HEADER_CG_QUICKSLOT_SWAP = 18,
- HEADER_CG_WHISPER = 19,
- HEADER_CG_ITEM_DROP2 = 20,
- HEADER_CG_ON_CLICK = 26,
- HEADER_CG_EXCHANGE = 27,
- HEADER_CG_CHARACTER_POSITION = 28,
- HEADER_CG_SCRIPT_ANSWER = 29,
- HEADER_CG_QUEST_INPUT_STRING = 30,
- HEADER_CG_QUEST_CONFIRM = 31,
- HEADER_CG_SHOP = 50,
- HEADER_CG_FLY_TARGETING = 51,
- HEADER_CG_USE_SKILL = 52,
- HEADER_CG_ADD_FLY_TARGETING = 53,
- HEADER_CG_SHOOT = 54,
- HEADER_CG_MYSHOP = 55,
- HEADER_CG_ITEM_USE_TO_ITEM = 60,
- HEADER_CG_TARGET = 61,
- HEADER_CG_TEXT = 64, // @ ·Î ½ÃÀ۵Ǹé ÅؽºÆ®¸¦ ÆĽÌÇÑ´Ù.
- HEADER_CG_WARP = 65,
- HEADER_CG_SCRIPT_BUTTON = 66,
- HEADER_CG_MESSENGER = 67,
- HEADER_CG_MALL_CHECKOUT = 69,
- HEADER_CG_SAFEBOX_CHECKIN = 70, // ¾ÆÀÌÅÛÀ» â°í¿¡ ³Ö†š´Â´Ù.
- HEADER_CG_SAFEBOX_CHECKOUT = 71, // ¾ÆÀÌÅÛÀ» â°í·Î ºÎÅÍ »©¿Â´Ù.
- HEADER_CG_PARTY_INVITE = 72,
- HEADER_CG_PARTY_INVITE_ANSWER = 73,
- HEADER_CG_PARTY_REMOVE = 74,
- HEADER_CG_PARTY_SET_STATE = 75,
- HEADER_CG_PARTY_USE_SKILL = 76,
- HEADER_CG_SAFEBOX_ITEM_MOVE = 77,
- HEADER_CG_PARTY_PARAMETER = 78,
- HEADER_CG_GUILD = 80,
- HEADER_CG_ANSWER_MAKE_GUILD = 81,
- HEADER_CG_FISHING = 82,
- HEADER_CG_ITEM_GIVE = 83,
- HEADER_CG_EMPIRE = 90,
- HEADER_CG_REFINE = 96,
- HEADER_CG_MARK_LOGIN = 100,
- HEADER_CG_MARK_CRCLIST = 101,
- HEADER_CG_MARK_UPLOAD = 102,
- HEADER_CG_MARK_IDXLIST = 104,
- HEADER_CG_HACK = 105,
- HEADER_CG_CHANGE_NAME = 106,
- HEADER_CG_LOGIN2 = 109,
- HEADER_CG_DUNGEON = 110,
- HEADER_CG_LOGIN3 = 111,
- HEADER_CG_GUILD_SYMBOL_UPLOAD = 112,
- HEADER_CG_SYMBOL_CRC = 113,
- // SCRIPT_SELECT_ITEM
- HEADER_CG_SCRIPT_SELECT_ITEM = 114,
- // END_OF_SCRIPT_SELECT_ITEM
- HEADER_CG_LOGIN5_OPENID = 116, //OpenID : Ŭ¶óÀ̾ðÆ®·ÎºÎÅÍ OpenID ÀÎÁõÅ°¸¦ ¹Þ´Â´Ù.
- // HEADER_CG_ROULETTE = 200,
- // HEADER_CG_RUNUP_MATRIX_ANSWER = 201,
- //
- HEADER_CG_PASSPOD_ANSWER = 202,
- //NOTE : ÀÌ·± °³XXX Á¤¸» ÀÌ°Å Packet¼³°èÇÑ »ç¶÷Àº ´©±¸³Ä. ÀÌ·¸°Ô ÄÚµùÇÏ°í ¹äÀÌ ³Ñ¾î°¡³ª.
- //enumÀ» º°µµ·Î ±¸º°À» ÇÏ´ø°¡. ¾Æ´Ô namepsace·Î ±¸º°À» ÇÏ´ø°¡..
- //Á¤¸» packet generator±îÁö´Â ¹Ù¶óÁöµµ ¾Ê´Â´Ù. ÀÌ·± ¾¾XX
- //ÀÌ·¯´Ù°¡ ¼ýÀÚ °ãÄ¡¸é ´©°¡ Ã¥ÀÓÁö´Âµ¥???
- HEADER_CG_HS_ACK = 203,
- HEADER_CG_XTRAP_ACK = 204,
- HEADER_CG_DRAGON_SOUL_REFINE = 205,
- HEADER_CG_STATE_CHECKER = 206,
- HEADER_CG_CLIENT_VERSION = 0xfd,
- HEADER_CG_CLIENT_VERSION2 = 0xf1,
- /********************************************************/
- HEADER_GC_KEY_AGREEMENT_COMPLETED = 0xfa, // _IMPROVED_PACKET_ENCRYPTION_
- HEADER_GC_KEY_AGREEMENT = 0xfb, // _IMPROVED_PACKET_ENCRYPTION_
- HEADER_GC_TIME_SYNC = 0xfc,
- HEADER_GC_PHASE = 0xfd,
- HEADER_GC_BINDUDP = 0xfe,
- HEADER_GC_HANDSHAKE = 0xff,
- HEADER_GC_CHARACTER_ADD = 1,
- HEADER_GC_CHARACTER_DEL = 2,
- HEADER_GC_MOVE = 3,
- HEADER_GC_CHAT = 4,
- HEADER_GC_SYNC_POSITION = 5,
- HEADER_GC_LOGIN_SUCCESS = 6,
- HEADER_GC_LOGIN_SUCCESS_NEWSLOT = 32,
- HEADER_GC_LOGIN_FAILURE = 7,
- HEADER_GC_CHARACTER_CREATE_SUCCESS = 8,
- HEADER_GC_CHARACTER_CREATE_FAILURE = 9,
- HEADER_GC_CHARACTER_DELETE_SUCCESS = 10,
- HEADER_GC_CHARACTER_DELETE_WRONG_SOCIAL_ID = 11,
- HEADER_GC_ATTACK = 12,
- HEADER_GC_STUN = 13,
- HEADER_GC_DEAD = 14,
- HEADER_GC_MAIN_CHARACTER_OLD = 15,
- HEADER_GC_CHARACTER_POINTS = 16,
- HEADER_GC_CHARACTER_POINT_CHANGE = 17,
- HEADER_GC_CHANGE_SPEED = 18,
- HEADER_GC_CHARACTER_UPDATE = 19,
- HEADER_GC_CHARACTER_UPDATE_NEW = 24,
- HEADER_GC_ITEM_DEL = 20,
- HEADER_GC_ITEM_SET = 21,
- HEADER_GC_ITEM_USE = 22,
- HEADER_GC_ITEM_DROP = 23,
- HEADER_GC_ITEM_UPDATE = 25,
- HEADER_GC_ITEM_GROUND_ADD = 26,
- HEADER_GC_ITEM_GROUND_DEL = 27,
- HEADER_GC_QUICKSLOT_ADD = 28,
- HEADER_GC_QUICKSLOT_DEL = 29,
- HEADER_GC_QUICKSLOT_SWAP = 30,
- HEADER_GC_ITEM_OWNERSHIP = 31,
- HEADER_GC_WHISPER = 34,
- HEADER_GC_MOTION = 36,
- HEADER_GC_PARTS = 37,
- HEADER_GC_SHOP = 38,
- HEADER_GC_SHOP_SIGN = 39,
- HEADER_GC_DUEL_START = 40,
- HEADER_GC_PVP = 41,
- HEADER_GC_EXCHANGE = 42,
- HEADER_GC_CHARACTER_POSITION = 43,
- HEADER_GC_PING = 44,
- HEADER_GC_SCRIPT = 45,
- HEADER_GC_QUEST_CONFIRM = 46,
- HEADER_GC_MOUNT = 61,
- HEADER_GC_OWNERSHIP = 62,
- HEADER_GC_TARGET = 63,
- HEADER_GC_WARP = 65,
- HEADER_GC_ADD_FLY_TARGETING = 69,
- HEADER_GC_CREATE_FLY = 70,
- HEADER_GC_FLY_TARGETING = 71,
- HEADER_GC_SKILL_LEVEL_OLD = 72,
- HEADER_GC_SKILL_LEVEL = 76,
- HEADER_GC_MESSENGER = 74,
- HEADER_GC_GUILD = 75,
- HEADER_GC_PARTY_INVITE = 77,
- HEADER_GC_PARTY_ADD = 78,
- HEADER_GC_PARTY_UPDATE = 79,
- HEADER_GC_PARTY_REMOVE = 80,
- HEADER_GC_QUEST_INFO = 81,
- HEADER_GC_REQUEST_MAKE_GUILD = 82,
- HEADER_GC_PARTY_PARAMETER = 83,
- HEADER_GC_SAFEBOX_SET = 85,
- HEADER_GC_SAFEBOX_DEL = 86,
- HEADER_GC_SAFEBOX_WRONG_PASSWORD = 87,
- HEADER_GC_SAFEBOX_SIZE = 88,
- HEADER_GC_FISHING = 89,
- HEADER_GC_EMPIRE = 90,
- HEADER_GC_PARTY_LINK = 91,
- HEADER_GC_PARTY_UNLINK = 92,
- HEADER_GC_REFINE_INFORMATION_OLD = 95,
- HEADER_GC_VIEW_EQUIP = 99,
- HEADER_GC_MARK_BLOCK = 100,
- HEADER_GC_MARK_IDXLIST = 102,
- HEADER_GC_TIME = 106,
- HEADER_GC_CHANGE_NAME = 107,
- HEADER_GC_DUNGEON = 110,
- HEADER_GC_WALK_MODE = 111,
- HEADER_GC_SKILL_GROUP = 112,
- HEADER_GC_MAIN_CHARACTER = 113,
- // HEADER_GC_USE_POTION = 114,
- HEADER_GC_SEPCIAL_EFFECT = 114,
- HEADER_GC_NPC_POSITION = 115,
- HEADER_GC_MATRIX_CARD = 116,
- HEADER_GC_LOGIN_KEY = 118,
- HEADER_GC_REFINE_INFORMATION = 119,
- HEADER_GC_CHANNEL = 121,
- // 122 HEADER_GC_MALL_OPEN
- HEADER_GC_TARGET_UPDATE = 123,
- HEADER_GC_TARGET_DELETE = 124,
- HEADER_GC_TARGET_CREATE = 125,
- HEADER_GC_AFFECT_ADD = 126,
- HEADER_GC_AFFECT_REMOVE = 127,
- HEADER_GC_MALL_OPEN = 122,
- HEADER_GC_MALL_SET = 128,
- HEADER_GC_MALL_DEL = 129,
- HEADER_GC_LAND_LIST = 130,
- HEADER_GC_LOVER_INFO = 131,
- HEADER_GC_LOVE_POINT_UPDATE = 132,
- HEADER_GC_SYMBOL_DATA = 133,
- // MINING
- HEADER_GC_DIG_MOTION = 134,
- // END_OF_MINING
- HEADER_GC_DAMAGE_INFO = 135,
- HEADER_GC_CHAR_ADDITIONAL_INFO = 136,
- // SUPPORT_BGM
- HEADER_GC_MAIN_CHARACTER3_BGM = 137,
- HEADER_GC_MAIN_CHARACTER4_BGM_VOL = 138,
- // END_OF_SUPPORT_BGM
- HEADER_GC_AUTH_SUCCESS = 150,
- HEADER_GC_PANAMA_PACK = 151,
- //HYBRID CRYPT
- HEADER_GC_HYBRIDCRYPT_KEYS = 152,
- HEADER_GC_HYBRIDCRYPT_SDB = 153, // SDB means Supplmentary Data Blocks
- //HYBRID CRYPT
- HEADER_GC_AUTH_SUCCESS_OPENID = 154,
- // ROULETTE
- HEADER_GC_ROULETTE = 200,
- // END_ROULETTE
- //
- HEADER_GC_REQUEST_PASSPOD = 202,
- HEADER_GC_REQUEST_PASSPOD_FAILED = 203,
- HEADER_GC_HS_REQUEST = 204,
- HEADER_GC_XTRAP_CS1_REQUEST = 205,
- HEADER_GC_SPECIFIC_EFFECT = 208,
- HEADER_GC_DRAGON_SOUL_REFINE = 209,
- HEADER_GC_RESPOND_CHANNELSTATUS = 210,
- /////////////////////////////////////////////////////////////////////////////
- HEADER_GG_LOGIN = 1,
- HEADER_GG_LOGOUT = 2,
- HEADER_GG_RELAY = 3,
- HEADER_GG_NOTICE = 4,
- HEADER_GG_SHUTDOWN = 5,
- HEADER_GG_GUILD = 6,
- HEADER_GG_DISCONNECT = 7, // ´©±º°¡ÀÇ Á¢¼ÓÀ» °Á¦·Î ²÷À» ¶§
- HEADER_GG_SHOUT = 8,
- HEADER_GG_SETUP = 9,
- HEADER_GG_MESSENGER_ADD = 10,
- HEADER_GG_MESSENGER_REMOVE = 11,
- HEADER_GG_FIND_POSITION = 12,
- HEADER_GG_WARP_CHARACTER = 13,
- HEADER_GG_MESSENGER_MOBILE = 14,
- HEADER_GG_GUILD_WAR_ZONE_MAP_INDEX = 15,
- HEADER_GG_TRANSFER = 16,
- HEADER_GG_XMAS_WARP_SANTA = 17,
- HEADER_GG_XMAS_WARP_SANTA_REPLY = 18,
- HEADER_GG_RELOAD_CRC_LIST = 19,
- HEADER_GG_LOGIN_PING = 20,
- HEADER_GG_CHECK_CLIENT_VERSION = 21,
- HEADER_GG_BLOCK_CHAT = 22,
- HEADER_GG_BLOCK_EXCEPTION = 24,
- HEADER_GG_SIEGE = 25,
- HEADER_GG_MONARCH_NOTICE = 26,
- HEADER_GG_MONARCH_TRANSFER = 27,
- HEADER_GG_PCBANG_UPDATE = 28,
- HEADER_GG_CHECK_AWAKENESS = 29,
- };
- #pragma pack(1)
- typedef struct SPacketGGSetup
- {
- BYTE bHeader;
- WORD wPort;
- BYTE bChannel;
- } TPacketGGSetup;
- typedef struct SPacketGGLogin
- {
- BYTE bHeader;
- char szName[CHARACTER_NAME_MAX_LEN + 1];
- DWORD dwPID;
- BYTE bEmpire;
- long lMapIndex;
- BYTE bChannel;
- } TPacketGGLogin;
- typedef struct SPacketGGLogout
- {
- BYTE bHeader;
- char szName[CHARACTER_NAME_MAX_LEN + 1];
- } TPacketGGLogout;
- typedef struct SPacketGGRelay
- {
- BYTE bHeader;
- char szName[CHARACTER_NAME_MAX_LEN + 1];
- long lSize;
- } TPacketGGRelay;
- typedef struct SPacketGGNotice
- {
- BYTE bHeader;
- long lSize;
- } TPacketGGNotice;
- typedef struct SPacketGGMonarchNotice
- {
- BYTE bHeader;
- BYTE bEmpire;
- long lSize;
- } TPacketGGMonarchNotice;
- //FORKED_ROAD
- typedef struct SPacketGGForkedMapInfo
- {
- BYTE bHeader;
- BYTE bPass;
- BYTE bSungzi;
- } TPacketGGForkedMapInfo;
- //END_FORKED_ROAD
- typedef struct SPacketGGShutdown
- {
- BYTE bHeader;
- } TPacketGGShutdown;
- typedef struct SPacketGGGuild
- {
- BYTE bHeader;
- BYTE bSubHeader;
- DWORD dwGuild;
- } TPacketGGGuild;
- enum
- {
- GUILD_SUBHEADER_GG_CHAT,
- GUILD_SUBHEADER_GG_SET_MEMBER_COUNT_BONUS,
- };
- typedef struct SPacketGGGuildChat
- {
- BYTE bHeader;
- BYTE bSubHeader;
- DWORD dwGuild;
- char szText[CHAT_MAX_LEN + 1];
- } TPacketGGGuildChat;
- typedef struct SPacketGGParty
- {
- BYTE header;
- BYTE subheader;
- DWORD pid;
- DWORD leaderpid;
- } TPacketGGParty;
- enum
- {
- PARTY_SUBHEADER_GG_CREATE,
- PARTY_SUBHEADER_GG_DESTROY,
- PARTY_SUBHEADER_GG_JOIN,
- PARTY_SUBHEADER_GG_QUIT,
- };
- typedef struct SPacketGGDisconnect
- {
- BYTE bHeader;
- char szLogin[LOGIN_MAX_LEN + 1];
- } TPacketGGDisconnect;
- typedef struct SPacketGGShout
- {
- BYTE bHeader;
- BYTE bEmpire;
- char szText[CHAT_MAX_LEN + 1];
- } TPacketGGShout;
- typedef struct SPacketGGXmasWarpSanta
- {
- BYTE bHeader;
- BYTE bChannel;
- long lMapIndex;
- } TPacketGGXmasWarpSanta;
- typedef struct SPacketGGXmasWarpSantaReply
- {
- BYTE bHeader;
- BYTE bChannel;
- } TPacketGGXmasWarpSantaReply;
- typedef struct SMessengerData
- {
- char szMobile[MOBILE_MAX_LEN + 1];
- } TMessengerData;
- typedef struct SPacketGGMessenger
- {
- BYTE bHeader;
- char szAccount[CHARACTER_NAME_MAX_LEN + 1];
- char szCompanion[CHARACTER_NAME_MAX_LEN + 1];
- } TPacketGGMessenger;
- typedef struct SPacketGGMessengerMobile
- {
- BYTE bHeader;
- char szName[CHARACTER_NAME_MAX_LEN + 1];
- char szMobile[MOBILE_MAX_LEN + 1];
- } TPacketGGMessengerMobile;
- typedef struct SPacketGGFindPosition
- {
- BYTE header;
- DWORD dwFromPID; // Àú À§Ä¡·Î ¿öÇÁÇÏ·Á´Â »ç¶÷
- DWORD dwTargetPID; // ã´Â »ç¶÷
- } TPacketGGFindPosition;
- typedef struct SPacketGGWarpCharacter
- {
- BYTE header;
- DWORD pid;
- long x;
- long y;
- } TPacketGGWarpCharacter;
- // HEADER_GG_GUILD_WAR_ZONE_MAP_INDEX = 15,
- typedef struct SPacketGGGuildWarMapIndex
- {
- BYTE bHeader;
- DWORD dwGuildID1;
- DWORD dwGuildID2;
- long lMapIndex;
- } TPacketGGGuildWarMapIndex;
- typedef struct SPacketGGTransfer
- {
- BYTE bHeader;
- char szName[CHARACTER_NAME_MAX_LEN + 1];
- long lX, lY;
- } TPacketGGTransfer;
- typedef struct SPacketGGLoginPing
- {
- BYTE bHeader;
- char szLogin[LOGIN_MAX_LEN + 1];
- } TPacketGGLoginPing;
- typedef struct SPacketGGBlockChat
- {
- BYTE bHeader;
- char szName[CHARACTER_NAME_MAX_LEN + 1];
- long lBlockDuration;
- } TPacketGGBlockChat;
- /* Ŭ¶óÀ̾ðÆ® Ãø¿¡¼ º¸³»´Â ÆÐŶ */
- typedef struct command_text
- {
- BYTE bHeader;
- } TPacketCGText;
- /* ·Î±×ÀÎ (1) */
- typedef struct command_handshake
- {
- BYTE bHeader;
- DWORD dwHandshake;
- DWORD dwTime;
- long lDelta;
- } TPacketCGHandshake;
- typedef struct command_login
- {
- BYTE header;
- char login[LOGIN_MAX_LEN + 1];
- char passwd[PASSWD_MAX_LEN + 1];
- } TPacketCGLogin;
- typedef struct command_login2
- {
- BYTE header;
- char login[LOGIN_MAX_LEN + 1];
- DWORD dwLoginKey;
- DWORD adwClientKey[4];
- } TPacketCGLogin2;
- typedef struct command_login3
- {
- BYTE header;
- char login[LOGIN_MAX_LEN + 1];
- char passwd[PASSWD_MAX_LEN + 1];
- DWORD adwClientKey[4];
- } TPacketCGLogin3;
- typedef struct command_login5
- {
- BYTE header;
- char authKey[OPENID_AUTHKEY_LEN + 1];
- DWORD adwClientKey[4];
- } TPacketCGLogin5;
- typedef struct command_matrix_card
- {
- BYTE bHeader;
- char szAnswer[MATRIX_ANSWER_MAX_LEN + 1];
- } TPacketCGMatrixCard;
- typedef struct packet_matrix_card
- {
- BYTE bHeader;
- DWORD dwRows;
- DWORD dwCols;
- } TPacketGCMatrixCard;
- typedef struct packet_login_key
- {
- BYTE bHeader;
- DWORD dwLoginKey;
- } TPacketGCLoginKey;
- typedef struct command_player_select
- {
- BYTE header;
- BYTE index;
- } TPacketCGPlayerSelect;
- typedef struct command_player_delete
- {
- BYTE header;
- BYTE index;
- char private_code[8];
- } TPacketCGPlayerDelete;
- typedef struct command_player_create
- {
- BYTE header;
- BYTE index;
- char name[CHARACTER_NAME_MAX_LEN + 1];
- WORD job;
- BYTE shape;
- BYTE Con;
- BYTE Int;
- BYTE Str;
- BYTE Dex;
- } TPacketCGPlayerCreate;
- typedef struct command_player_create_success
- {
- BYTE header;
- BYTE bAccountCharacterIndex;
- TSimplePlayer player;
- } TPacketGCPlayerCreateSuccess;
- // °ø°Ý
- typedef struct command_attack
- {
- BYTE bHeader;
- BYTE bType;
- DWORD dwVID;
- BYTE bCRCMagicCubeProcPiece;
- BYTE bCRCMagicCubeFilePiece;
- } TPacketCGAttack;
- enum EMoveFuncType
- {
- FUNC_WAIT,
- FUNC_MOVE,
- FUNC_ATTACK,
- FUNC_COMBO,
- FUNC_MOB_SKILL,
- _FUNC_SKILL,
- FUNC_MAX_NUM,
- FUNC_SKILL = 0x80,
- };
- // À̵¿
- typedef struct command_move
- {
- BYTE bHeader;
- BYTE bFunc;
- BYTE bArg;
- BYTE bRot;
- long lX;
- long lY;
- DWORD dwTime;
- } TPacketCGMove;
- typedef struct command_sync_position_element
- {
- DWORD dwVID;
- long lX;
- long lY;
- } TPacketCGSyncPositionElement;
- // À§Ä¡ µ¿±âÈ
- typedef struct command_sync_position // °¡º¯ ÆÐŶ
- {
- BYTE bHeader;
- WORD wSize;
- } TPacketCGSyncPosition;
- /* äÆà (3) */
- typedef struct command_chat // °¡º¯ ÆÐŶ
- {
- BYTE header;
- WORD size;
- BYTE type;
- } TPacketCGChat;
- /* ±Ó¼Ó¸» */
- typedef struct command_whisper
- {
- BYTE bHeader;
- WORD wSize;
- char szNameTo[CHARACTER_NAME_MAX_LEN + 1];
- } TPacketCGWhisper;
- typedef struct command_entergame
- {
- BYTE header;
- } TPacketCGEnterGame;
- typedef struct command_item_use
- {
- BYTE header;
- TItemPos Cell;
- } TPacketCGItemUse;
- typedef struct command_item_use_to_item
- {
- BYTE header;
- TItemPos Cell;
- TItemPos TargetCell;
- } TPacketCGItemUseToItem;
- typedef struct command_item_drop
- {
- BYTE header;
- TItemPos Cell;
- DWORD gold;
- } TPacketCGItemDrop;
- typedef struct command_item_drop2
- {
- BYTE header;
- TItemPos Cell;
- DWORD gold;
- WORD count;
- } TPacketCGItemDrop2;
- typedef struct command_item_move
- {
- BYTE header;
- TItemPos Cell;
- TItemPos CellTo;
- WORD count;
- } TPacketCGItemMove;
- typedef struct command_item_pickup
- {
- BYTE header;
- DWORD vid;
- } TPacketCGItemPickup;
- typedef struct command_quickslot_add
- {
- BYTE header;
- BYTE pos;
- TQuickslot slot;
- } TPacketCGQuickslotAdd;
- typedef struct command_quickslot_del
- {
- BYTE header;
- BYTE pos;
- } TPacketCGQuickslotDel;
- typedef struct command_quickslot_swap
- {
- BYTE header;
- BYTE pos;
- BYTE change_pos;
- } TPacketCGQuickslotSwap;
- enum
- {
- SHOP_SUBHEADER_CG_END,
- SHOP_SUBHEADER_CG_BUY,
- SHOP_SUBHEADER_CG_SELL,
- SHOP_SUBHEADER_CG_SELL2
- };
- typedef struct command_shop_buy
- {
- BYTE count;
- } TPacketCGShopBuy;
- typedef struct command_shop_sell
- {
- BYTE pos;
- BYTE count;
- } TPacketCGShopSell;
- typedef struct command_shop
- {
- BYTE header;
- BYTE subheader;
- } TPacketCGShop;
- typedef struct command_on_click
- {
- BYTE header;
- DWORD vid;
- } TPacketCGOnClick;
- enum
- {
- EXCHANGE_SUBHEADER_CG_START, /* arg1 == vid of target character */
- EXCHANGE_SUBHEADER_CG_ITEM_ADD, /* arg1 == position of item */
- EXCHANGE_SUBHEADER_CG_ITEM_DEL, /* arg1 == position of item */
- EXCHANGE_SUBHEADER_CG_ELK_ADD, /* arg1 == amount of gold */
- EXCHANGE_SUBHEADER_CG_ACCEPT, /* arg1 == not used */
- EXCHANGE_SUBHEADER_CG_CANCEL, /* arg1 == not used */
- };
- typedef struct command_exchange
- {
- BYTE header;
- BYTE sub_header;
- DWORD arg1;
- BYTE arg2;
- TItemPos Pos;
- } TPacketCGExchange;
- typedef struct command_position
- {
- BYTE header;
- BYTE position;
- } TPacketCGPosition;
- typedef struct command_script_answer
- {
- BYTE header;
- BYTE answer;
- //char file[32 + 1];
- //BYTE answer[16 + 1];
- } TPacketCGScriptAnswer;
- typedef struct command_script_button
- {
- BYTE header;
- unsigned int idx;
- } TPacketCGScriptButton;
- typedef struct command_quest_input_string
- {
- BYTE header;
- char msg[64+1];
- } TPacketCGQuestInputString;
- typedef struct command_quest_confirm
- {
- BYTE header;
- BYTE answer;
- DWORD requestPID;
- } TPacketCGQuestConfirm;
- /*
- * ¼¹ö Ãø¿¡¼ º¸³»´Â ÆÐŶ
- */
- typedef struct packet_quest_confirm
- {
- BYTE header;
- char msg[64+1];
- long timeout;
- DWORD requestPID;
- } TPacketGCQuestConfirm;
- typedef struct packet_handshake
- {
- BYTE bHeader;
- DWORD dwHandshake;
- DWORD dwTime;
- long lDelta;
- } TPacketGCHandshake;
- enum EPhase
- {
- PHASE_CLOSE,
- PHASE_HANDSHAKE,
- PHASE_LOGIN,
- PHASE_SELECT,
- PHASE_LOADING,
- PHASE_GAME,
- PHASE_DEAD,
- PHASE_CLIENT_CONNECTING,
- PHASE_DBCLIENT,
- PHASE_P2P,
- PHASE_AUTH,
- PHASE_TEEN,
- PHASE_PASSPOD,
- };
- typedef struct packet_phase
- {
- BYTE header;
- BYTE phase;
- } TPacketGCPhase;
- typedef struct packet_bindudp
- {
- BYTE header;
- DWORD addr;
- WORD port;
- } TPacketGCBindUDP;
- enum
- {
- LOGIN_FAILURE_ALREADY = 1,
- LOGIN_FAILURE_ID_NOT_EXIST = 2,
- LOGIN_FAILURE_WRONG_PASS = 3,
- LOGIN_FAILURE_FALSE = 4,
- LOGIN_FAILURE_NOT_TESTOR = 5,
- LOGIN_FAILURE_NOT_TEST_TIME = 6,
- LOGIN_FAILURE_FULL = 7
- };
- typedef struct packet_login_success
- {
- BYTE bHeader;
- TSimplePlayer players[PLAYER_PER_ACCOUNT];
- DWORD guild_id[PLAYER_PER_ACCOUNT];
- char guild_name[PLAYER_PER_ACCOUNT][GUILD_NAME_MAX_LEN+1];
- DWORD handle;
- DWORD random_key;
- } TPacketGCLoginSuccess;
- typedef struct packet_auth_success
- {
- BYTE bHeader;
- DWORD dwLoginKey;
- BYTE bResult;
- } TPacketGCAuthSuccess;
- typedef struct packet_auth_success_openid
- {
- BYTE bHeader;
- DWORD dwLoginKey;
- BYTE bResult;
- char login[LOGIN_MAX_LEN + 1];
- } TPacketGCAuthSuccessOpenID;
- typedef struct packet_login_failure
- {
- BYTE header;
- char szStatus[ACCOUNT_STATUS_MAX_LEN + 1];
- } TPacketGCLoginFailure;
- typedef struct packet_create_failure
- {
- BYTE header;
- BYTE bType;
- } TPacketGCCreateFailure;
- enum
- {
- ADD_CHARACTER_STATE_DEAD = (1 << 0),
- ADD_CHARACTER_STATE_SPAWN = (1 << 1),
- ADD_CHARACTER_STATE_GUNGON = (1 << 2),
- ADD_CHARACTER_STATE_KILLER = (1 << 3),
- ADD_CHARACTER_STATE_PARTY = (1 << 4),
- };
- enum ECharacterEquipmentPart
- {
- CHR_EQUIPPART_ARMOR,
- CHR_EQUIPPART_WEAPON,
- CHR_EQUIPPART_HEAD,
- CHR_EQUIPPART_HAIR,
- #ifdef __SASH_SYSTEM__
- CHR_EQUIPPART_SASH,
- #endif
- CHR_EQUIPPART_NUM,
- };
- #ifdef __ITEM_SHINING__
- enum EShiningParts
- {
- CHR_SHINING_WEAPON_1,
- CHR_SHINING_WEAPON_2,
- CHR_SHINING_WEAPON_3,
- CHR_SHINING_ARMOR_1,
- CHR_SHINING_ARMOR_2,
- CHR_SHINING_SPECIAL,
- CHR_SHINING_NUM,
- };
- #endif
- typedef struct packet_add_char
- {
- BYTE header;
- DWORD dwVID;
- float angle;
- long x;
- long y;
- long z;
- BYTE bType;
- WORD wRaceNum;
- BYTE bMovingSpeed;
- BYTE bAttackSpeed;
- BYTE bStateFlag;
- DWORD dwAffectFlag[2]; // È¿°ú
- } TPacketGCCharacterAdd;
- typedef struct packet_char_additional_info
- {
- BYTE header;
- DWORD dwVID;
- char name[CHARACTER_NAME_MAX_LEN + 1];
- WORD awPart[CHR_EQUIPPART_NUM];
- #ifdef __ITEM_SHINING__
- DWORD adwShining[CHR_SHINING_NUM];
- #endif
- BYTE bEmpire;
- DWORD dwGuildID;
- DWORD dwLevel;
- long sAlignment;
- BYTE bPKMode;
- DWORD dwMountVnum;
- #ifdef __PRESTIGE_SYSTEM__
- BYTE bPrestige;
- #endif
- } TPacketGCCharacterAdditionalInfo;
- /*
- typedef struct packet_update_char_old
- {
- BYTE header;
- DWORD dwVID;
- WORD awPart[CHR_EQUIPPART_NUM];
- BYTE bMovingSpeed;
- BYTE bAttackSpeed;
- BYTE bStateFlag;
- DWORD dwAffectFlag[2];
- DWORD dwGuildID;
- shot sAlignment;
- BYTE bPKMode;
- DWORD dwMountVnum;
- } TPacketGCCharacterUpdateOld;
- */
- typedef struct packet_update_char
- {
- BYTE header;
- DWORD dwVID;
- WORD awPart[CHR_EQUIPPART_NUM];
- #ifdef __ITEM_SHINING__
- DWORD adwShining[CHR_SHINING_NUM];
- #endif
- BYTE bMovingSpeed;
- BYTE bAttackSpeed;
- BYTE bStateFlag;
- DWORD dwAffectFlag[2];
- DWORD dwGuildID;
- long sAlignment;
- BYTE bPKMode;
- DWORD dwMountVnum;
- #ifdef __PRESTIGE_SYSTEM__
- BYTE bPrestige;
- #endif
- //WORD wRaceNum;
- } TPacketGCCharacterUpdate;
- typedef struct packet_del_char
- {
- BYTE header;
- DWORD id;
- } TPacketGCCharacterDelete;
- typedef struct packet_chat // °¡º¯ ÆÐŶ
- {
- BYTE header;
- WORD size;
- BYTE type;
- DWORD id;
- BYTE bEmpire;
- } TPacketGCChat;
- typedef struct packet_whisper // °¡º¯ ÆÐŶ
- {
- BYTE bHeader;
- WORD wSize;
- BYTE bType;
- char szNameFrom[CHARACTER_NAME_MAX_LEN + 1];
- } TPacketGCWhisper;
- typedef struct packet_main_character
- {
- BYTE header;
- DWORD dwVID;
- WORD wRaceNum;
- char szName[CHARACTER_NAME_MAX_LEN + 1];
- long lx, ly, lz;
- BYTE empire;
- BYTE skill_group;
- } TPacketGCMainCharacter;
- // SUPPORT_BGM
- typedef struct packet_main_character3_bgm
- {
- enum
- {
- MUSIC_NAME_LEN = 24,
- };
- BYTE header;
- DWORD dwVID;
- WORD wRaceNum;
- char szChrName[CHARACTER_NAME_MAX_LEN + 1];
- char szBGMName[MUSIC_NAME_LEN + 1];
- long lx, ly, lz;
- BYTE empire;
- BYTE skill_group;
- } TPacketGCMainCharacter3_BGM;
- typedef struct packet_main_character4_bgm_vol
- {
- enum
- {
- MUSIC_NAME_LEN = 24,
- };
- BYTE header;
- DWORD dwVID;
- WORD wRaceNum;
- char szChrName[CHARACTER_NAME_MAX_LEN + 1];
- char szBGMName[MUSIC_NAME_LEN + 1];
- float fBGMVol;
- long lx, ly, lz;
- BYTE empire;
- BYTE skill_group;
- } TPacketGCMainCharacter4_BGM_VOL;
- // END_OF_SUPPORT_BGM
- typedef struct packet_points
- {
- BYTE header;
- INT points[POINT_MAX_NUM];
- } TPacketGCPoints;
- typedef struct packet_skill_level
- {
- BYTE bHeader;
- TPlayerSkill skills[SKILL_MAX_NUM];
- } TPacketGCSkillLevel;
- typedef struct packet_point_change
- {
- int header;
- DWORD dwVID;
- BYTE type;
- long amount;
- long value;
- } TPacketGCPointChange;
- typedef struct packet_stun
- {
- BYTE header;
- DWORD vid;
- } TPacketGCStun;
- typedef struct packet_dead
- {
- BYTE header;
- DWORD vid;
- } TPacketGCDead;
- struct TPacketGCItemDelDeprecated
- {
- BYTE header;
- TItemPos Cell;
- DWORD vnum;
- BYTE count;
- long alSockets[ITEM_SOCKET_MAX_NUM];
- TPlayerItemAttribute aAttr[ITEM_ATTRIBUTE_MAX_NUM];
- #ifdef __CHANGE_LOOK_SYSTEM__
- DWORD dwVnum;
- #endif
- };
- typedef struct packet_item_set
- {
- BYTE header;
- TItemPos Cell;
- DWORD vnum;
- WORD count;
- DWORD flags;
- DWORD anti_flags;
- bool highlight;
- long alSockets[ITEM_SOCKET_MAX_NUM];
- TPlayerItemAttribute aAttr[ITEM_ATTRIBUTE_MAX_NUM];
- #ifdef __CHANGE_LOOK_SYSTEM__
- DWORD dwVnum;
- #endif
- } TPacketGCItemSet;
- typedef struct packet_item_del
- {
- BYTE header;
- BYTE pos;
- } TPacketGCItemDel;
- struct packet_item_use
- {
- BYTE header;
- TItemPos Cell;
- DWORD ch_vid;
- DWORD victim_vid;
- DWORD vnum;
- };
- struct packet_item_move
- {
- BYTE header;
- TItemPos Cell;
- TItemPos CellTo;
- };
- typedef struct packet_item_update
- {
- BYTE header;
- TItemPos Cell;
- WORD count;
- long alSockets[ITEM_SOCKET_MAX_NUM];
- TPlayerItemAttribute aAttr[ITEM_ATTRIBUTE_MAX_NUM];
- #ifdef __CHANGE_LOOK_SYSTEM__
- DWORD dwVnum;
- #endif
- } TPacketGCItemUpdate;
- typedef struct packet_item_ground_add
- {
- BYTE bHeader;
- long x, y, z;
- DWORD dwVID;
- DWORD dwVnum;
- } TPacketGCItemGroundAdd;
- typedef struct packet_item_ownership
- {
- BYTE bHeader;
- DWORD dwVID;
- char szName[CHARACTER_NAME_MAX_LEN + 1];
- } TPacketGCItemOwnership;
- typedef struct packet_item_ground_del
- {
- BYTE bHeader;
- DWORD dwVID;
- } TPacketGCItemGroundDel;
- struct packet_quickslot_add
- {
- BYTE header;
- BYTE pos;
- TQuickslot slot;
- };
- struct packet_quickslot_del
- {
- BYTE header;
- BYTE pos;
- };
- struct packet_quickslot_swap
- {
- BYTE header;
- BYTE pos;
- BYTE pos_to;
- };
- struct packet_motion
- {
- BYTE header;
- DWORD vid;
- DWORD victim_vid;
- WORD motion;
- };
- enum EPacketShopSubHeaders
- {
- SHOP_SUBHEADER_GC_START,
- SHOP_SUBHEADER_GC_END,
- SHOP_SUBHEADER_GC_UPDATE_ITEM,
- SHOP_SUBHEADER_GC_UPDATE_PRICE,
- SHOP_SUBHEADER_GC_OK,
- SHOP_SUBHEADER_GC_NOT_ENOUGH_MONEY,
- SHOP_SUBHEADER_GC_SOLDOUT,
- SHOP_SUBHEADER_GC_INVENTORY_FULL,
- SHOP_SUBHEADER_GC_INVALID_POS,
- SHOP_SUBHEADER_GC_SOLD_OUT,
- SHOP_SUBHEADER_GC_START_EX,
- SHOP_SUBHEADER_GC_NOT_ENOUGH_MONEY_EX,
- };
- struct packet_shop_item
- {
- DWORD vnum;
- DWORD price;
- WORD count;
- BYTE display_pos;
- long alSockets[ITEM_SOCKET_MAX_NUM];
- TPlayerItemAttribute aAttr[ITEM_ATTRIBUTE_MAX_NUM];
- #ifdef __CHANGE_LOOK_SYSTEM__
- DWORD dwLookVnum;
- #endif
- };
- typedef struct packet_shop_start
- {
- DWORD owner_vid;
- struct packet_shop_item items[SHOP_HOST_ITEM_MAX_NUM];
- } TPacketGCShopStart;
- typedef struct packet_shop_start_ex // ´ÙÀ½¿¡ TSubPacketShopTab* shop_tabs ÀÌ µû¶ó¿È.
- {
- typedef struct sub_packet_shop_tab
- {
- char name[SHOP_TAB_NAME_MAX];
- BYTE coin_type;
- packet_shop_item items[SHOP_HOST_ITEM_MAX_NUM];
- } TSubPacketShopTab;
- DWORD owner_vid;
- BYTE shop_tab_count;
- } TPacketGCShopStartEx;
- typedef struct packet_shop_update_item
- {
- BYTE pos;
- struct packet_shop_item item;
- } TPacketGCShopUpdateItem;
- typedef struct packet_shop_update_price
- {
- int iPrice;
- } TPacketGCShopUpdatePrice;
- typedef struct packet_shop // °¡º¯ ÆÐŶ
- {
- BYTE header;
- WORD size;
- BYTE subheader;
- } TPacketGCShop;
- struct packet_exchange
- {
- BYTE header;
- BYTE sub_header;
- BYTE is_me;
- DWORD arg1; // vnum
- TItemPos arg2; // cell
- DWORD arg3; // count
- long alSockets[ITEM_SOCKET_MAX_NUM];
- TPlayerItemAttribute aAttr[ITEM_ATTRIBUTE_MAX_NUM];
- #ifdef __CHANGE_LOOK_SYSTEM__
- DWORD dwLookVnum;
- #endif
- };
- enum EPacketTradeSubHeaders
- {
- EXCHANGE_SUBHEADER_GC_START, /* arg1 == vid */
- EXCHANGE_SUBHEADER_GC_ITEM_ADD, /* arg1 == vnum arg2 == pos arg3 == count */
- EXCHANGE_SUBHEADER_GC_ITEM_DEL,
- EXCHANGE_SUBHEADER_GC_GOLD_ADD, /* arg1 == gold */
- EXCHANGE_SUBHEADER_GC_ACCEPT, /* arg1 == accept */
- EXCHANGE_SUBHEADER_GC_END, /* arg1 == not used */
- EXCHANGE_SUBHEADER_GC_ALREADY, /* arg1 == not used */
- EXCHANGE_SUBHEADER_GC_LESS_GOLD, /* arg1 == not used */
- };
- struct packet_position
- {
- BYTE header;
- DWORD vid;
- BYTE position;
- };
- typedef struct packet_ping
- {
- BYTE header;
- } TPacketGCPing;
- struct packet_script
- {
- BYTE header;
- WORD size;
- BYTE skin;
- WORD src_size;
- };
- typedef struct packet_change_speed
- {
- BYTE header;
- DWORD vid;
- WORD moving_speed;
- } TPacketGCChangeSpeed;
- struct packet_mount
- {
- BYTE header;
- DWORD vid;
- DWORD mount_vid;
- BYTE pos;
- DWORD x, y;
- };
- typedef struct packet_move
- {
- BYTE bHeader;
- BYTE bFunc;
- BYTE bArg;
- BYTE bRot;
- DWORD dwVID;
- long lX;
- long lY;
- DWORD dwTime;
- DWORD dwDuration;
- } TPacketGCMove;
- // ¼ÒÀ¯±Ç
- typedef struct packet_ownership
- {
- BYTE bHeader;
- DWORD dwOwnerVID;
- DWORD dwVictimVID;
- } TPacketGCOwnership;
- // À§Ä¡ µ¿±âÈ ÆÐŶÀÇ bCount ¸¸Å ºÙ´Â ´ÜÀ§
- typedef struct packet_sync_position_element
- {
- DWORD dwVID;
- long lX;
- long lY;
- } TPacketGCSyncPositionElement;
- // À§Ä¡ µ¿±âÈ
- typedef struct packet_sync_position // °¡º¯ ÆÐŶ
- {
- BYTE bHeader;
- WORD wSize; // °³¼ö = (wSize - sizeof(TPacketGCSyncPosition)) / sizeof(TPacketGCSyncPositionElement)
- } TPacketGCSyncPosition;
- typedef struct packet_fly
- {
- BYTE bHeader;
- BYTE bType;
- DWORD dwStartVID;
- DWORD dwEndVID;
- } TPacketGCCreateFly;
- typedef struct command_fly_targeting
- {
- BYTE bHeader;
- DWORD dwTargetVID;
- long x, y;
- } TPacketCGFlyTargeting;
- typedef struct packet_fly_targeting
- {
- BYTE bHeader;
- DWORD dwShooterVID;
- DWORD dwTargetVID;
- long x, y;
- } TPacketGCFlyTargeting;
- typedef struct packet_shoot
- {
- BYTE bHeader;
- BYTE bType;
- } TPacketCGShoot;
- typedef struct packet_duel_start
- {
- BYTE header;
- WORD wSize; // DWORD°¡ ¸î°³? °³¼ö = (wSize - sizeof(TPacketGCPVPList)) / 4
- } TPacketGCDuelStart;
- enum EPVPModes
- {
- PVP_MODE_NONE,
- PVP_MODE_AGREE,
- PVP_MODE_FIGHT,
- PVP_MODE_REVENGE
- };
- typedef struct packet_pvp
- {
- BYTE bHeader;
- DWORD dwVIDSrc;
- DWORD dwVIDDst;
- BYTE bMode; // 0 ÀÌ¸é ²û, 1À̸é ÄÔ
- } TPacketGCPVP;
- typedef struct command_use_skill
- {
- BYTE bHeader;
- DWORD dwVnum;
- DWORD dwVID;
- } TPacketCGUseSkill;
- typedef struct command_target
- {
- BYTE header;
- DWORD dwVID;
- } TPacketCGTarget;
- typedef struct packet_target
- {
- BYTE header;
- DWORD dwVID;
- BYTE bHPPercent;
- } TPacketGCTarget;
- typedef struct packet_warp
- {
- BYTE bHeader;
- long lX;
- long lY;
- long lAddr;
- WORD wPort;
- } TPacketGCWarp;
- typedef struct command_warp
- {
- BYTE bHeader;
- } TPacketCGWarp;
- struct packet_quest_info
- {
- BYTE header;
- WORD size;
- WORD index;
- BYTE flag;
- };
- enum
- {
- MESSENGER_SUBHEADER_GC_LIST,
- MESSENGER_SUBHEADER_GC_LOGIN,
- MESSENGER_SUBHEADER_GC_LOGOUT,
- MESSENGER_SUBHEADER_GC_INVITE,
- MESSENGER_SUBHEADER_GC_MOBILE
- };
- typedef struct packet_messenger
- {
- BYTE header;
- WORD size;
- BYTE subheader;
- } TPacketGCMessenger;
- typedef struct packet_messenger_guild_list
- {
- BYTE connected;
- BYTE length;
- //char login[LOGIN_MAX_LEN+1];
- } TPacketGCMessengerGuildList;
- typedef struct packet_messenger_guild_login
- {
- BYTE length;
- //char login[LOGIN_MAX_LEN+1];
- } TPacketGCMessengerGuildLogin;
- typedef struct packet_messenger_guild_logout
- {
- BYTE length;
- //char login[LOGIN_MAX_LEN+1];
- } TPacketGCMessengerGuildLogout;
- typedef struct packet_messenger_list_offline
- {
- BYTE connected; // always 0
- BYTE length;
- } TPacketGCMessengerListOffline;
- typedef struct packet_messenger_list_online
- {
- BYTE connected; // always 1
- BYTE length;
- } TPacketGCMessengerListOnline;
- enum
- {
- MESSENGER_SUBHEADER_CG_ADD_BY_VID,
- MESSENGER_SUBHEADER_CG_ADD_BY_NAME,
- MESSENGER_SUBHEADER_CG_REMOVE,
- MESSENGER_SUBHEADER_CG_INVITE_ANSWER,
- };
- typedef struct command_messenger
- {
- BYTE header;
- BYTE subheader;
- } TPacketCGMessenger;
- typedef struct command_messenger_add_by_vid
- {
- DWORD vid;
- } TPacketCGMessengerAddByVID;
- typedef struct command_messenger_add_by_name
- {
- BYTE length;
- //char login[LOGIN_MAX_LEN+1];
- } TPacketCGMessengerAddByName;
- typedef struct command_messenger_remove
- {
- char login[LOGIN_MAX_LEN+1];
- //DWORD account;
- } TPacketCGMessengerRemove;
- typedef struct command_safebox_checkout
- {
- BYTE bHeader;
- BYTE bSafePos;
- TItemPos ItemPos;
- } TPacketCGSafeboxCheckout;
- typedef struct command_safebox_checkin
- {
- BYTE bHeader;
- BYTE bSafePos;
- TItemPos ItemPos;
- } TPacketCGSafeboxCheckin;
- ///////////////////////////////////////////////////////////////////////////////////
- // Party
- typedef struct command_party_parameter
- {
- BYTE bHeader;
- BYTE bDistributeMode;
- } TPacketCGPartyParameter;
- typedef struct paryt_parameter
- {
- BYTE bHeader;
- BYTE bDistributeMode;
- } TPacketGCPartyParameter;
- typedef struct packet_party_add
- {
- BYTE header;
- DWORD pid;
- char name[CHARACTER_NAME_MAX_LEN+1];
- } TPacketGCPartyAdd;
- typedef struct command_party_invite
- {
- BYTE header;
- DWORD vid;
- } TPacketCGPartyInvite;
- typedef struct packet_party_invite
- {
- BYTE header;
- DWORD leader_vid;
- } TPacketGCPartyInvite;
- typedef struct command_party_invite_answer
- {
- BYTE header;
- DWORD leader_vid;
- BYTE accept;
- } TPacketCGPartyInviteAnswer;
- typedef struct packet_party_update
- {
- BYTE header;
- DWORD pid;
- BYTE role;
- BYTE percent_hp;
- short affects[7];
- } TPacketGCPartyUpdate;
- typedef struct packet_party_remove
- {
- BYTE header;
- DWORD pid;
- } TPacketGCPartyRemove;
- typedef struct packet_party_link
- {
- BYTE header;
- DWORD pid;
- DWORD vid;
- } TPacketGCPartyLink;
- typedef struct packet_party_unlink
- {
- BYTE header;
- DWORD pid;
- DWORD vid;
- } TPacketGCPartyUnlink;
- typedef struct command_party_remove
- {
- BYTE header;
- DWORD pid;
- } TPacketCGPartyRemove;
- typedef struct command_party_set_state
- {
- BYTE header;
- DWORD pid;
- BYTE byRole;
- BYTE flag;
- } TPacketCGPartySetState;
- enum
- {
- PARTY_SKILL_HEAL = 1,
- PARTY_SKILL_WARP = 2
- };
- typedef struct command_party_use_skill
- {
- BYTE header;
- BYTE bySkillIndex;
- DWORD vid;
- } TPacketCGPartyUseSkill;
- typedef struct packet_safebox_size
- {
- BYTE bHeader;
- BYTE bSize;
- } TPacketCGSafeboxSize;
- typedef struct packet_safebox_wrong_password
- {
- BYTE bHeader;
- } TPacketCGSafeboxWrongPassword;
- typedef struct command_empire
- {
- BYTE bHeader;
- BYTE bEmpire;
- } TPacketCGEmpire;
- typedef struct packet_empire
- {
- BYTE bHeader;
- BYTE bEmpire;
- } TPacketGCEmpire;
- enum
- {
- SAFEBOX_MONEY_STATE_SAVE,
- SAFEBOX_MONEY_STATE_WITHDRAW,
- };
- typedef struct command_safebox_money
- {
- BYTE bHeader;
- BYTE bState;
- long lMoney;
- } TPacketCGSafeboxMoney;
- typedef struct packet_safebox_money_change
- {
- BYTE bHeader;
- long lMoney;
- } TPacketGCSafeboxMoneyChange;
- // Guild
- enum
- {
- GUILD_SUBHEADER_GC_LOGIN,
- GUILD_SUBHEADER_GC_LOGOUT,
- GUILD_SUBHEADER_GC_LIST,
- GUILD_SUBHEADER_GC_GRADE,
- GUILD_SUBHEADER_GC_ADD,
- GUILD_SUBHEADER_GC_REMOVE,
- GUILD_SUBHEADER_GC_GRADE_NAME,
- GUILD_SUBHEADER_GC_GRADE_AUTH,
- GUILD_SUBHEADER_GC_INFO,
- GUILD_SUBHEADER_GC_COMMENTS,
- GUILD_SUBHEADER_GC_CHANGE_EXP,
- GUILD_SUBHEADER_GC_CHANGE_MEMBER_GRADE,
- GUILD_SUBHEADER_GC_SKILL_INFO,
- GUILD_SUBHEADER_GC_CHANGE_MEMBER_GENERAL,
- GUILD_SUBHEADER_GC_GUILD_INVITE,
- GUILD_SUBHEADER_GC_WAR,
- GUILD_SUBHEADER_GC_GUILD_NAME,
- GUILD_SUBHEADER_GC_GUILD_WAR_LIST,
- GUILD_SUBHEADER_GC_GUILD_WAR_END_LIST,
- GUILD_SUBHEADER_GC_WAR_SCORE,
- GUILD_SUBHEADER_GC_MONEY_CHANGE,
- };
- enum GUILD_SUBHEADER_CG
- {
- GUILD_SUBHEADER_CG_ADD_MEMBER,
- GUILD_SUBHEADER_CG_REMOVE_MEMBER,
- GUILD_SUBHEADER_CG_CHANGE_GRADE_NAME,
- GUILD_SUBHEADER_CG_CHANGE_GRADE_AUTHORITY,
- GUILD_SUBHEADER_CG_OFFER,
- GUILD_SUBHEADER_CG_POST_COMMENT,
- GUILD_SUBHEADER_CG_DELETE_COMMENT,
- GUILD_SUBHEADER_CG_REFRESH_COMMENT,
- GUILD_SUBHEADER_CG_CHANGE_MEMBER_GRADE,
- GUILD_SUBHEADER_CG_USE_SKILL,
- GUILD_SUBHEADER_CG_CHANGE_MEMBER_GENERAL,
- GUILD_SUBHEADER_CG_GUILD_INVITE_ANSWER,
- GUILD_SUBHEADER_CG_CHARGE_GSP,
- GUILD_SUBHEADER_CG_DEPOSIT_MONEY,
- GUILD_SUBHEADER_CG_WITHDRAW_MONEY,
- };
- typedef struct packet_guild
- {
- BYTE header;
- WORD size;
- BYTE subheader;
- } TPacketGCGuild;
- typedef struct packet_guild_name_t
- {
- BYTE header;
- WORD size;
- BYTE subheader;
- DWORD guildID;
- char guildName[GUILD_NAME_MAX_LEN];
- } TPacketGCGuildName;
- typedef struct packet_guild_war
- {
- DWORD dwGuildSelf;
- DWORD dwGuildOpp;
- BYTE bType;
- BYTE bWarState;
- } TPacketGCGuildWar;
- typedef struct command_guild
- {
- BYTE header;
- BYTE subheader;
- } TPacketCGGuild;
- typedef struct command_guild_answer_make_guild
- {
- BYTE header;
- char guild_name[GUILD_NAME_MAX_LEN+1];
- } TPacketCGAnswerMakeGuild;
- typedef struct command_guild_use_skill
- {
- DWORD dwVnum;
- DWORD dwPID;
- } TPacketCGGuildUseSkill;
- // Guild Mark
- typedef struct command_mark_login
- {
- BYTE header;
- DWORD handle;
- DWORD random_key;
- } TPacketCGMarkLogin;
- typedef struct command_mark_upload
- {
- BYTE header;
- DWORD gid;
- BYTE image[16*12*4];
- } TPacketCGMarkUpload;
- typedef struct command_mark_idxlist
- {
- BYTE header;
- } TPacketCGMarkIDXList;
- typedef struct command_mark_crclist
- {
- BYTE header;
- BYTE imgIdx;
- DWORD crclist[80];
- } TPacketCGMarkCRCList;
- typedef struct packet_mark_idxlist
- {
- BYTE header;
- DWORD bufSize;
- WORD count;
- //µÚ¿¡ size * (WORD + WORD)¸¸Å µ¥ÀÌÅÍ ºÙÀ½
- } TPacketGCMarkIDXList;
- typedef struct packet_mark_block
- {
- BYTE header;
- DWORD bufSize;
- BYTE imgIdx;
- DWORD count;
- // µÚ¿¡ 64 x 48 x Çȼ¿Å©±â(4¹ÙÀÌÆ®) = 12288¸¸Å µ¥ÀÌÅÍ ºÙÀ½
- } TPacketGCMarkBlock;
- typedef struct command_symbol_upload
- {
- BYTE header;
- WORD size;
- DWORD guild_id;
- } TPacketCGGuildSymbolUpload;
- typedef struct command_symbol_crc
- {
- BYTE header;
- DWORD guild_id;
- DWORD crc;
- DWORD size;
- } TPacketCGSymbolCRC;
- typedef struct packet_symbol_data
- {
- BYTE header;
- WORD size;
- DWORD guild_id;
- } TPacketGCGuildSymbolData;
- // Fishing
- typedef struct command_fishing
- {
- BYTE header;
- BYTE dir;
- } TPacketCGFishing;
- typedef struct packet_fishing
- {
- BYTE header;
- BYTE subheader;
- DWORD info;
- BYTE dir;
- } TPacketGCFishing;
- enum
- {
- FISHING_SUBHEADER_GC_START,
- FISHING_SUBHEADER_GC_STOP,
- FISHING_SUBHEADER_GC_REACT,
- FISHING_SUBHEADER_GC_SUCCESS,
- FISHING_SUBHEADER_GC_FAIL,
- FISHING_SUBHEADER_GC_FISH,
- };
- typedef struct command_give_item
- {
- BYTE byHeader;
- DWORD dwTargetVID;
- TItemPos ItemPos;
- BYTE byItemCount;
- } TPacketCGGiveItem;
- typedef struct SPacketCGHack
- {
- BYTE bHeader;
- char szBuf[255 + 1];
- } TPacketCGHack;
- // SubHeader - Dungeon
- enum
- {
- DUNGEON_SUBHEADER_GC_TIME_ATTACK_START = 0,
- DUNGEON_SUBHEADER_GC_DESTINATION_POSITION = 1,
- };
- typedef struct packet_dungeon
- {
- BYTE bHeader;
- WORD size;
- BYTE subheader;
- } TPacketGCDungeon;
- typedef struct packet_dungeon_dest_position
- {
- long x;
- long y;
- } TPacketGCDungeonDestPosition;
- typedef struct SPacketGCShopSign
- {
- BYTE bHeader;
- DWORD dwVID;
- char szSign[SHOP_SIGN_MAX_LEN + 1];
- } TPacketGCShopSign;
- typedef struct SPacketCGMyShop
- {
- BYTE bHeader;
- char szSign[SHOP_SIGN_MAX_LEN + 1];
- BYTE bCount;
- } TPacketCGMyShop;
- typedef struct SPacketGCTime
- {
- BYTE bHeader;
- time_t time;
- } TPacketGCTime;
- enum
- {
- WALKMODE_RUN,
- WALKMODE_WALK,
- };
- typedef struct SPacketGCWalkMode
- {
- BYTE header;
- DWORD vid;
- BYTE mode;
- } TPacketGCWalkMode;
- typedef struct SPacketGCChangeSkillGroup
- {
- BYTE header;
- BYTE skill_group;
- } TPacketGCChangeSkillGroup;
- typedef struct SPacketCGRefine
- {
- BYTE header;
- BYTE pos;
- BYTE type;
- } TPacketCGRefine;
- typedef struct SPacketCGRequestRefineInfo
- {
- BYTE header;
- BYTE pos;
- } TPacketCGRequestRefineInfo;
- typedef struct SPacketGCRefineInformaion
- {
- BYTE header;
- BYTE type;
- BYTE pos;
- DWORD src_vnum;
- DWORD result_vnum;
- BYTE material_count;
- int cost; // ¼Ò¿ä ºñ¿ë
- int prob; // È®·ü
- TRefineMaterial materials[REFINE_MATERIAL_MAX_NUM];
- } TPacketGCRefineInformation;
- struct TNPCPosition
- {
- BYTE bType;
- char name[CHARACTER_NAME_MAX_LEN+1];
- long x;
- long y;
- };
- typedef struct SPacketGCNPCPosition
- {
- BYTE header;
- WORD size;
- WORD count;
- // array of TNPCPosition
- } TPacketGCNPCPosition;
- typedef struct SPacketGCSpecialEffect
- {
- BYTE header;
- BYTE type;
- DWORD vid;
- } TPacketGCSpecialEffect;
- typedef struct SPacketCGChangeName
- {
- BYTE header;
- BYTE index;
- char name[CHARACTER_NAME_MAX_LEN+1];
- } TPacketCGChangeName;
- typedef struct SPacketGCChangeName
- {
- BYTE header;
- DWORD pid;
- char name[CHARACTER_NAME_MAX_LEN+1];
- } TPacketGCChangeName;
- typedef struct command_client_version
- {
- BYTE header;
- char filename[32+1];
- char timestamp[32+1];
- } TPacketCGClientVersion;
- typedef struct command_client_version2
- {
- BYTE header;
- char filename[32+1];
- char timestamp[32+1];
- } TPacketCGClientVersion2;
- typedef struct packet_channel
- {
- BYTE header;
- BYTE channel;
- } TPacketGCChannel;
- typedef struct pakcet_view_equip
- {
- BYTE header;
- DWORD vid;
- struct {
- DWORD vnum;
- WORD count;
- long alSockets[ITEM_SOCKET_MAX_NUM];
- TPlayerItemAttribute aAttr[ITEM_ATTRIBUTE_MAX_NUM];
- } equips[WEAR_MAX_NUM];
- } TPacketViewEquip;
- typedef struct
- {
- DWORD dwID;
- long x, y;
- long width, height;
- DWORD dwGuildID;
- } TLandPacketElement;
- typedef struct packet_land_list
- {
- BYTE header;
- WORD size;
- } TPacketGCLandList;
- typedef struct
- {
- BYTE bHeader;
- long lID;
- char szName[32+1];
- DWORD dwVID;
- BYTE bType;
- } TPacketGCTargetCreate;
- typedef struct
- {
- BYTE bHeader;
- long lID;
- long lX, lY;
- } TPacketGCTargetUpdate;
- typedef struct
- {
- BYTE bHeader;
- long lID;
- } TPacketGCTargetDelete;
- typedef struct
- {
- BYTE bHeader;
- TPacketAffectElement elem;
- } TPacketGCAffectAdd;
- typedef struct
- {
- BYTE bHeader;
- DWORD dwType;
- BYTE bApplyOn;
- } TPacketGCAffectRemove;
- typedef struct packet_lover_info
- {
- BYTE header;
- char name[CHARACTER_NAME_MAX_LEN + 1];
- BYTE love_point;
- } TPacketGCLoverInfo;
- typedef struct packet_love_point_update
- {
- BYTE header;
- BYTE love_point;
- } TPacketGCLovePointUpdate;
- // MINING
- typedef struct packet_dig_motion
- {
- BYTE header;
- DWORD vid;
- DWORD target_vid;
- BYTE count;
- } TPacketGCDigMotion;
- // END_OF_MINING
- // SCRIPT_SELECT_ITEM
- typedef struct command_script_select_item
- {
- BYTE header;
- DWORD selection;
- } TPacketCGScriptSelectItem;
- // END_OF_SCRIPT_SELECT_ITEM
- typedef struct packet_damage_info
- {
- BYTE header;
- DWORD dwVID;
- BYTE flag;
- int damage;
- } TPacketGCDamageInfo;
- enum
- {
- RUNUP_MATRIX_ANSWER_MAX_LEN = 4,
- RUNUP_MATRIX_QUIZ_MAX_LEN = 8 ,
- };
- typedef struct packet_runup_matrix_quiz
- {
- BYTE bHeader;
- char szQuiz[RUNUP_MATRIX_QUIZ_MAX_LEN + 1];
- } TPacketGCRunupMatrixQuiz;
- typedef struct command_runup_matrix_answer
- {
- BYTE bHeader;
- char szAnswer[RUNUP_MATRIX_ANSWER_MAX_LEN + 1];
- } TPacketCGRunupMatrixAnswer;
- typedef struct packet_passpod
- {
- BYTE bHeader;
- char szAnswer[8+1];
- } TPacketCGPasspod;
- typedef struct packet_passpod_failed
- {
- BYTE bHeader;
- char szMessage[128];
- } TPacketCGPasspodFailed;
- typedef struct tag_GGSiege
- {
- BYTE bHeader;
- BYTE bEmpire;
- BYTE bTowerCount;
- } TPacketGGSiege;
- typedef struct SPacketGGMonarchTransfer
- {
- BYTE bHeader;
- DWORD dwTargetPID;
- long x;
- long y;
- } TPacketMonarchGGTransfer;
- typedef struct SPacketGGPCBangUpdate
- {
- BYTE bHeader;
- unsigned long ulPCBangID;
- } TPacketPCBangUpdate;
- typedef struct SPacketGGCheckAwakeness
- {
- BYTE bHeader;
- } TPacketGGCheckAwakeness;
- typedef struct SPacketGCPanamaPack
- {
- BYTE bHeader;
- char szPackName[256];
- BYTE abIV[32];
- } TPacketGCPanamaPack;
- //TODO : ¾Æ¿ì ¯³ª..°¡º¯ÆÐŶ »çÀÌÁî ¹Þ¾ÆµéÀϼö ÀÖ°Ô ÆÐŶ Çڵ鷯 Refactoring ÇÏÀÚ.
- typedef struct SPacketGCHybridCryptKeys
- {
- SPacketGCHybridCryptKeys() : m_pStream(NULL) {}
- ~SPacketGCHybridCryptKeys()
- {
- //GCC ¿¡¼± NULL delete Çصµ ±¦Âú³ª? ÀÏ´Ü ¾ÈÀüÇÏ°Ô NULL üũ ÇÏÀÚ. ( ±Ùµ¥ ÀÌ°Å C++ Ç¥ÁؾƴϾú³ª --a )
- if( m_pStream )
- {
- delete[] m_pStream;
- m_pStream = NULL;
- }
- }
- DWORD GetStreamSize()
- {
- return sizeof(bHeader) + sizeof(WORD) + sizeof(int) + KeyStreamLen;
- }
- BYTE* GetStreamData()
- {
- if( m_pStream )
- delete[] m_pStream;
- uDynamicPacketSize = (WORD)GetStreamSize();
- m_pStream = new BYTE[ uDynamicPacketSize ];
- memcpy( m_pStream, &bHeader, 1 );
- memcpy( m_pStream+1, &uDynamicPacketSize, 2 );
- memcpy( m_pStream+3, &KeyStreamLen, 4 );
- if( KeyStreamLen > 0 )
- memcpy( m_pStream+7, pDataKeyStream, KeyStreamLen );
- return m_pStream;
- }
- BYTE bHeader;
- WORD uDynamicPacketSize; // ºô¾î¸ÔÀ» Ŭ¶ó DynamicPacketHeader ±¸Á¶¶§¹®¿¡ ¸ÂÃçÁà¾ßÇÑ´Ù -_-;
- int KeyStreamLen;
- BYTE* pDataKeyStream;
- private:
- BYTE* m_pStream;
- } TPacketGCHybridCryptKeys;
- typedef struct SPacketGCPackageSDB
- {
- SPacketGCPackageSDB() : m_pDataSDBStream(NULL), m_pStream(NULL) {}
- ~SPacketGCPackageSDB()
- {
- if( m_pStream )
- {
- delete[] m_pStream;
- m_pStream = NULL;
- }
- }
- DWORD GetStreamSize()
- {
- return sizeof(bHeader) + sizeof(WORD) + sizeof(int) + iStreamLen;
- }
- BYTE* GetStreamData()
- {
- if( m_pStream )
- delete[] m_pStream;
- uDynamicPacketSize = GetStreamSize();
- m_pStream = new BYTE[ uDynamicPacketSize ];
- memcpy( m_pStream, &bHeader, 1 );
- memcpy( m_pStream+1, &uDynamicPacketSize, 2 );
- memcpy( m_pStream+3, &iStreamLen, 4 );
- if( iStreamLen > 0 )
- memcpy( m_pStream+7, m_pDataSDBStream, iStreamLen );
- return m_pStream;
- }
- BYTE bHeader;
- WORD uDynamicPacketSize; // ºô¾î¸ÔÀ» Ŭ¶ó DynamicPacketHeader ±¸Á¶¶§¹®¿¡ ¸ÂÃçÁà¾ßÇÑ´Ù -_-;
- int iStreamLen;
- BYTE* m_pDataSDBStream;
- private:
- BYTE* m_pStream;
- } TPacketGCPackageSDB;
- #ifdef _IMPROVED_PACKET_ENCRYPTION_
- struct TPacketKeyAgreement
- {
- static const int MAX_DATA_LEN = 256;
- BYTE bHeader;
- WORD wAgreedLength;
- WORD wDataLength;
- BYTE data[MAX_DATA_LEN];
- };
- struct TPacketKeyAgreementCompleted
- {
- BYTE bHeader;
- BYTE data[3]; // dummy (not used)
- };
- #endif // _IMPROVED_PACKET_ENCRYPTION_
- #define MAX_EFFECT_FILE_NAME 128
- typedef struct SPacketGCSpecificEffect
- {
- BYTE header;
- DWORD vid;
- char effect_file[MAX_EFFECT_FILE_NAME];
- } TPacketGCSpecificEffect;
- // ¿ëÈ¥¼®
- enum EDragonSoulRefineWindowRefineType
- {
- DragonSoulRefineWindow_UPGRADE,
- DragonSoulRefineWindow_IMPROVEMENT,
- DragonSoulRefineWindow_REFINE,
- };
- enum EPacketCGDragonSoulSubHeaderType
- {
- DS_SUB_HEADER_OPEN,
- DS_SUB_HEADER_CLOSE,
- DS_SUB_HEADER_DO_REFINE_GRADE,
- DS_SUB_HEADER_DO_REFINE_STEP,
- DS_SUB_HEADER_DO_REFINE_STRENGTH,
- DS_SUB_HEADER_REFINE_FAIL,
- DS_SUB_HEADER_REFINE_FAIL_MAX_REFINE,
- DS_SUB_HEADER_REFINE_FAIL_INVALID_MATERIAL,
- DS_SUB_HEADER_REFINE_FAIL_NOT_ENOUGH_MONEY,
- DS_SUB_HEADER_REFINE_FAIL_NOT_ENOUGH_MATERIAL,
- DS_SUB_HEADER_REFINE_FAIL_TOO_MUCH_MATERIAL,
- DS_SUB_HEADER_REFINE_SUCCEED,
- };
- typedef struct SPacketCGDragonSoulRefine
- {
- SPacketCGDragonSoulRefine() : header (HEADER_CG_DRAGON_SOUL_REFINE)
- {}
- BYTE header;
- BYTE bSubType;
- TItemPos ItemGrid[DRAGON_SOUL_REFINE_GRID_SIZE];
- } TPacketCGDragonSoulRefine;
- typedef struct SPacketGCDragonSoulRefine
- {
- SPacketGCDragonSoulRefine() : header(HEADER_GC_DRAGON_SOUL_REFINE)
- {}
- BYTE header;
- BYTE bSubType;
- TItemPos Pos;
- } TPacketGCDragonSoulRefine;
- typedef struct SPacketCGStateCheck
- {
- BYTE header;
- unsigned long key;
- unsigned long index;
- } TPacketCGStateCheck;
- typedef struct SPacketGCStateCheck
- {
- BYTE header;
- unsigned long key;
- unsigned long index;
- unsigned char state;
- } TPacketGCStateCheck;
- #ifdef __SASH_SYSTEM__
- enum
- {
- HEADER_CG_SASH = 211,
- HEADER_GC_SASH = 215,
- SASH_SUBHEADER_GC_OPEN = 0,
- SASH_SUBHEADER_GC_CLOSE,
- SASH_SUBHEADER_GC_ADDED,
- SASH_SUBHEADER_GC_REMOVED,
- SASH_SUBHEADER_CG_REFINED,
- SASH_SUBHEADER_CG_CLOSE = 0,
- SASH_SUBHEADER_CG_ADD,
- SASH_SUBHEADER_CG_REMOVE,
- SASH_SUBHEADER_CG_REFINE,
- };
- typedef struct SPacketSash
- {
- BYTE header;
- BYTE subheader;
- bool bWindow;
- DWORD dwPrice;
- BYTE bPos;
- TItemPos tPos;
- DWORD dwItemVnum;
- DWORD dwMinAbs;
- DWORD dwMaxAbs;
- } TPacketSash;
- #endif
- #pragma pack()
- #endif
char.cpp
- #include "stdafx.h"
- #include "../../common/teen_packet.h"
- #include "../../common/VnumHelper.h"
- #include "char.h"
- #include "config.h"
- #include "utils.h"
- #include "crc32.h"
- #include "char_manager.h"
- #include "desc_client.h"
- #include "desc_manager.h"
- #include "buffer_manager.h"
- #include "item_manager.h"
- #include "motion.h"
- #include "vector.h"
- #include "packet.h"
- #include "cmd.h"
- #include "fishing.h"
- #include "exchange.h"
- #include "battle.h"
- #include "affect.h"
- #include "shop.h"
- #include "shop_manager.h"
- #include "safebox.h"
- #include "regen.h"
- #include "pvp.h"
- #include "party.h"
- #include "start_position.h"
- #include "questmanager.h"
- #include "log.h"
- #include "p2p.h"
- #include "guild.h"
- #include "guild_manager.h"
- #include "dungeon.h"
- #include "messenger_manager.h"
- #include "unique_item.h"
- #include "priv_manager.h"
- #include "war_map.h"
- #include "xmas_event.h"
- #include "banword.h"
- #include "target.h"
- #include "wedding.h"
- #include "mob_manager.h"
- #include "mining.h"
- #include "monarch.h"
- #include "castle.h"
- #include "arena.h"
- #include "dev_log.h"
- #include "horsename_manager.h"
- #include "pcbang.h"
- #include "gm.h"
- #include "map_location.h"
- #include "BlueDragon_Binder.h"
- #include "HackShield.h"
- #include "skill_power.h"
- #include "XTrapManager.h"
- #include "buff_on_attributes.h"
- #ifdef __PET_SYSTEM__
- #include "PetSystem.h"
- #endif
- #include "DragonSoul.h"
- extern const BYTE g_aBuffOnAttrPoints;
- extern bool RaceToJob(unsigned race, unsigned *ret_job);
- extern int g_nPortalLimitTime;
- extern int test_server;
- extern bool IS_SUMMONABLE_ZONE(int map_index); // char_item.cpp
- bool CAN_ENTER_ZONE(const LPCHARACTER& ch, int map_index);
- bool CAN_ENTER_ZONE(const LPCHARACTER& ch, int map_index)
- {
- switch (map_index)
- {
- case 301:
- case 302:
- case 303:
- case 304:
- if (ch->GetLevel() < 90)
- return false;
- }
- return true;
- }
- // <Factor> DynamicCharacterPtr member function definitions
- LPCHARACTER DynamicCharacterPtr::Get() const {
- LPCHARACTER p = NULL;
- if (is_pc) {
- p = CHARACTER_MANAGER::instance().FindByPID(id);
- } else {
- p = CHARACTER_MANAGER::instance().Find(id);
- }
- return p;
- }
- DynamicCharacterPtr& DynamicCharacterPtr::operator=(LPCHARACTER character) {
- if (character == NULL) {
- Reset();
- return *this;
- }
- if (character->IsPC()) {
- is_pc = true;
- id = character->GetPlayerID();
- } else {
- is_pc = false;
- id = character->GetVID();
- }
- return *this;
- }
- CHARACTER::CHARACTER()
- {
- m_stateIdle.Set(this, &CHARACTER::BeginStateEmpty, &CHARACTER::StateIdle, &CHARACTER::EndStateEmpty);
- m_stateMove.Set(this, &CHARACTER::BeginStateEmpty, &CHARACTER::StateMove, &CHARACTER::EndStateEmpty);
- m_stateBattle.Set(this, &CHARACTER::BeginStateEmpty, &CHARACTER::StateBattle, &CHARACTER::EndStateEmpty);
- Initialize();
- }
- CHARACTER::~CHARACTER()
- {
- Destroy();
- }
- void CHARACTER::Initialize()
- {
- CEntity::Initialize(ENTITY_CHARACTER);
- m_bNoOpenedShop = true;
- m_bOpeningSafebox = false;
- m_fSyncTime = get_float_time()-3;
- m_dwPlayerID = 0;
- m_dwKillerPID = 0;
- m_iMoveCount = 0;
- m_pkRegen = NULL;
- regen_id_ = 0;
- m_posRegen.x = m_posRegen.y = m_posRegen.z = 0;
- m_posStart.x = m_posStart.y = 0;
- m_posDest.x = m_posDest.y = 0;
- m_fRegenAngle = 0.0f;
- m_pkMobData = NULL;
- m_pkMobInst = NULL;
- m_pkShop = NULL;
- m_pkChrShopOwner = NULL;
- m_pkMyShop = NULL;
- m_pkExchange = NULL;
- m_pkParty = NULL;
- m_pkPartyRequestEvent = NULL;
- m_pGuild = NULL;
- m_pkChrTarget = NULL;
- m_pkMuyeongEvent = NULL;
- m_pkWarpNPCEvent = NULL;
- m_pkDeadEvent = NULL;
- m_pkStunEvent = NULL;
- m_pkSaveEvent = NULL;
- m_pkRecoveryEvent = NULL;
- m_pkTimedEvent = NULL;
- m_pkFishingEvent = NULL;
- m_pkWarpEvent = NULL;
- // MINING
- m_pkMiningEvent = NULL;
- // END_OF_MINING
- m_pkPoisonEvent = NULL;
- m_pkFireEvent = NULL;
- m_pkCheckSpeedHackEvent = NULL;
- m_speed_hack_count = 0;
- m_pkAffectEvent = NULL;
- m_afAffectFlag = TAffectFlag(0, 0);
- m_pkDestroyWhenIdleEvent = NULL;
- m_pkChrSyncOwner = NULL;
- memset(&m_points, 0, sizeof(m_points));
- memset(&m_pointsInstant, 0, sizeof(m_pointsInstant));
- memset(&m_quickslot, 0, sizeof(m_quickslot));
- m_bCharType = CHAR_TYPE_MONSTER;
- SetPosition(POS_STANDING);
- m_dwPlayStartTime = m_dwLastMoveTime = get_dword_time();
- GotoState(m_stateIdle);
- m_dwStateDuration = 1;
- m_dwLastAttackTime = get_dword_time() - 20000;
- m_bAddChrState = 0;
- m_pkChrStone = NULL;
- m_pkSafebox = NULL;
- m_iSafeboxSize = -1;
- m_iSafeboxLoadTime = 0;
- m_pkMall = NULL;
- m_iMallLoadTime = 0;
- m_posWarp.x = m_posWarp.y = m_posWarp.z = 0;
- m_lWarpMapIndex = 0;
- m_posExit.x = m_posExit.y = m_posExit.z = 0;
- m_lExitMapIndex = 0;
- m_pSkillLevels = NULL;
- m_dwMoveStartTime = 0;
- m_dwMoveDuration = 0;
- m_dwFlyTargetID = 0;
- m_dwNextStatePulse = 0;
- m_dwLastDeadTime = get_dword_time()-180000;
- m_bSkipSave = false;
- m_bItemLoaded = false;
- m_bHasPoisoned = false;
- m_pkDungeon = NULL;
- m_iEventAttr = 0;
- m_kAttackLog.dwVID = 0;
- m_kAttackLog.dwTime = 0;
- m_bNowWalking = m_bWalking = false;
- ResetChangeAttackPositionTime();
- m_bDetailLog = false;
- m_bMonsterLog = false;
- m_bDisableCooltime = false;
- m_iAlignment = 0;
- m_iRealAlignment = 0;
- m_iKillerModePulse = 0;
- m_bPKMode = PK_MODE_PEACE;
- m_dwQuestNPCVID = 0;
- m_dwQuestByVnum = 0;
- m_pQuestItem = NULL;
- m_szMobileAuth[0] = '\0';
- m_dwUnderGuildWarInfoMessageTime = get_dword_time()-60000;
- m_bUnderRefine = false;
- // REFINE_NPC
- m_dwRefineNPCVID = 0;
- // END_OF_REFINE_NPC
- m_dwPolymorphRace = 0;
- m_bStaminaConsume = false;
- ResetChainLightningIndex();
- m_dwMountVnum = 0;
- m_chHorse = NULL;
- m_chRider = NULL;
- m_pWarMap = NULL;
- m_pWeddingMap = NULL;
- m_bChatCounter = 0;
- ResetStopTime();
- m_dwLastVictimSetTime = get_dword_time() - 3000;
- m_iMaxAggro = -100;
- m_bSendHorseLevel = 0;
- m_bSendHorseHealthGrade = 0;
- m_bSendHorseStaminaGrade = 0;
- m_dwLoginPlayTime = 0;
- m_pkChrMarried = NULL;
- m_posSafeboxOpen.x = -1000;
- m_posSafeboxOpen.y = -1000;
- // EQUIP_LAST_SKILL_DELAY
- m_dwLastSkillTime = get_dword_time();
- // END_OF_EQUIP_LAST_SKILL_DELAY
- // MOB_SKILL_COOLTIME
- memset(m_adwMobSkillCooltime, 0, sizeof(m_adwMobSkillCooltime));
- // END_OF_MOB_SKILL_COOLTIME
- m_isinPCBang = false;
- // ARENA
- m_pArena = NULL;
- m_nPotionLimit = quest::CQuestManager::instance().GetEventFlag("arena_potion_limit_count");
- // END_ARENA
- //PREVENT_TRADE_WINDOW
- m_isOpenSafebox = 0;
- //END_PREVENT_TRADE_WINDOW
- //PREVENT_REFINE_HACK
- m_iRefineTime = 0;
- //END_PREVENT_REFINE_HACK
- //RESTRICT_USE_SEED_OR_MOONBOTTLE
- m_iSeedTime = 0;
- //END_RESTRICT_USE_SEED_OR_MOONBOTTLE
- //PREVENT_PORTAL_AFTER_EXCHANGE
- m_iExchangeTime = 0;
- //END_PREVENT_PORTAL_AFTER_EXCHANGE
- //
- m_iSafeboxLoadTime = 0;
- m_iMyShopTime = 0;
- InitMC();
- m_deposit_pulse = 0;
- SET_OVER_TIME(this, OT_NONE);
- m_strNewName = "";
- m_known_guild.clear();
- m_dwLogOffInterval = 0;
- m_bComboSequence = 0;
- m_dwLastComboTime = 0;
- m_bComboIndex = 0;
- m_iComboHackCount = 0;
- m_dwSkipComboAttackByTime = 0;
- m_dwMountTime = 0;
- m_dwLastGoldDropTime = 0;
- m_HackShieldCheckEvent = NULL;
- m_HackShieldCheckMode = false;
- m_bIsLoadedAffect = false;
- cannot_dead = false;
- #ifdef __PET_SYSTEM__
- m_petSystem = 0;
- m_bIsPet = false;
- #endif
- m_fAttMul = 1.0f;
- m_fDamMul = 1.0f;
- m_pointsInstant.iDragonSoulActiveDeck = -1;
- memset(&m_tvLastSyncTime, 0, sizeof(m_tvLastSyncTime));
- m_iSyncHackCount = 0;
- #ifdef __SASH_SYSTEM__
- m_bSashCombination = false;
- m_bSashAbsorption = false;
- #endif
- #ifdef __PRESTIGE_SYSTEM__
- SetPrestigeLevel(0);
- #endif
- }
- void CHARACTER::Create(const char * c_pszName, DWORD vid, bool isPC)
- {
- static int s_crc = 172814;
- char crc_string[128+1];
- snprintf(crc_string, sizeof(crc_string), "%s%p%d", c_pszName, this, ++s_crc);
- m_vid = VID(vid, GetCRC32(crc_string, strlen(crc_string)));
- if (isPC)
- m_stName = c_pszName;
- }
- void CHARACTER::Destroy()
- {
- CloseMyShop();
- if (m_pkRegen)
- {
- if (m_pkDungeon) {
- // Dungeon regen may not be valid at this point
- if (m_pkDungeon->IsValidRegen(m_pkRegen, regen_id_)) {
- --m_pkRegen->count;
- }
- } else {
- // Is this really safe?
- --m_pkRegen->count;
- }
- m_pkRegen = NULL;
- }
- if (m_pkDungeon)
- {
- SetDungeon(NULL);
- }
- #ifdef __PET_SYSTEM__
- if (m_petSystem)
- {
- m_petSystem->Destroy();
- delete m_petSystem;
- m_petSystem = 0;
- }
- #endif
- HorseSummon(false);
- if (GetRider())
- GetRider()->ClearHorseInfo();
- if( IsPC() )
- {
- if (isHackShieldEnable)
- {
- CHackShieldManager::instance().DeleteClientHandle(GetPlayerID());
- }
- }
- if (GetDesc())
- {
- GetDesc()->BindCharacter(NULL);
- // BindDesc(NULL);
- }
- if (m_pkExchange)
- m_pkExchange->Cancel();
- SetVictim(NULL);
- if (GetShop())
- {
- GetShop()->RemoveGuest(this);
- SetShop(NULL);
- }
- ClearStone();
- ClearSync();
- ClearTarget();
- if (NULL == m_pkMobData)
- {
- DragonSoul_CleanUp();
- ClearItem();
- }
- // <Factor> m_pkParty becomes NULL after CParty destructor call!
- LPPARTY party = m_pkParty;
- if (party)
- {
- if (party->GetLeaderPID() == GetVID() && !IsPC())
- {
- M2_DELETE(party);
- }
- else
- {
- party->Unlink(this);
- if (!IsPC())
- party->Quit(GetVID());
- }
- SetParty(NULL); // ¾ÈÇصµ µÇÁö¸¸ ¾ÈÀüÇÏ°Ô.
- }
- if (m_pkMobInst)
- {
- M2_DELETE(m_pkMobInst);
- m_pkMobInst = NULL;
- }
- m_pkMobData = NULL;
- if (m_pkSafebox)
- {
- M2_DELETE(m_pkSafebox);
- m_pkSafebox = NULL;
- }
- if (m_pkMall)
- {
- M2_DELETE(m_pkMall);
- m_pkMall = NULL;
- }
- m_set_pkChrSpawnedBy.clear();
- StopMuyeongEvent();
- event_cancel(&m_pkWarpNPCEvent);
- event_cancel(&m_pkRecoveryEvent);
- event_cancel(&m_pkDeadEvent);
- event_cancel(&m_pkSaveEvent);
- event_cancel(&m_pkTimedEvent);
- event_cancel(&m_pkStunEvent);
- event_cancel(&m_pkFishingEvent);
- event_cancel(&m_pkPoisonEvent);
- event_cancel(&m_pkFireEvent);
- event_cancel(&m_pkPartyRequestEvent);
- //DELAYED_WARP
- event_cancel(&m_pkWarpEvent);
- event_cancel(&m_pkCheckSpeedHackEvent);
- //END_DELAYED_WARP
- // RECALL_DELAY
- //event_cancel(&m_pkRecallEvent);
- // END_OF_RECALL_DELAY
- // MINING
- event_cancel(&m_pkMiningEvent);
- // END_OF_MINING
- StopHackShieldCheckCycle();
- for (itertype(m_mapMobSkillEvent) it = m_mapMobSkillEvent.begin(); it != m_mapMobSkillEvent.end(); ++it)
- {
- LPEVENT pkEvent = it->second;
- event_cancel(&pkEvent);
- }
- m_mapMobSkillEvent.clear();
- //event_cancel(&m_pkAffectEvent);
- ClearAffect();
- for (TMapBuffOnAttrs::iterator it = m_map_buff_on_attrs.begin(); it != m_map_buff_on_attrs.end(); it++)
- {
- if (NULL != it->second)
- {
- M2_DELETE(it->second);
- }
- }
- m_map_buff_on_attrs.clear();
- event_cancel(&m_pkDestroyWhenIdleEvent);
- if (m_pSkillLevels)
- {
- M2_DELETE_ARRAY(m_pSkillLevels);
- m_pSkillLevels = NULL;
- }
- CEntity::Destroy();
- if (GetSectree())
- GetSectree()->RemoveEntity(this);
- if (m_bMonsterLog)
- CHARACTER_MANAGER::instance().UnregisterForMonsterLog(this);
- }
- const char * CHARACTER::GetName() const
- {
- return m_stName.empty() ? (m_pkMobData ? m_pkMobData->m_table.szLocaleName : "") : m_stName.c_str();
- }
- void CHARACTER::OpenMyShop(const char * c_pszSign, TShopItemTable * pTable, BYTE bItemCount)
- {
- if (GetPart(PART_MAIN) > 2)
- {
- ChatPacket(CHAT_TYPE_INFO, LC_TEXT("°©¿ÊÀ» ¹þ¾î¾ß °³ÀÎ »óÁ¡À» ¿ ¼ö ÀÖ½À´Ï´Ù."));
- return;
- }
- if (GetMyShop()) // ÀÌ¹Ì ¼¥ÀÌ ¿·Á ÀÖÀ¸¸é ´Ý´Â´Ù.
- {
- CloseMyShop();
- return;
- }
- // ÁøÇàÁßÀÎ Äù½ºÆ®°¡ ÀÖÀ¸¸é »óÁ¡À» ¿ ¼ö ¾ø´Ù.
- quest::PC * pPC = quest::CQuestManager::instance().GetPCForce(GetPlayerID());
- // GetPCForce´Â NULLÀÏ ¼ö ¾øÀ¸¹Ç·Î µû·Î È®ÀÎÇÏÁö ¾ÊÀ½
- if (pPC->IsRunning())
- return;
- if (bItemCount == 0)
- return;
- int64_t nTotalMoney = 0;
- for (int n = 0; n < bItemCount; ++n)
- {
- nTotalMoney += static_cast<int64_t>((pTable+n)->price);
- }
- nTotalMoney += static_cast<int64_t>(GetGold());
- if (GOLD_MAX <= nTotalMoney)
- {
- sys_err("[OVERFLOW_GOLD] Overflow (GOLD_MAX) id %u name %s", GetPlayerID(), GetName());
- ChatPacket(CHAT_TYPE_INFO, LC_TEXT("20¾ï ³ÉÀ» ÃÊ°úÇÏ¿© »óÁ¡À» ¿¼ö°¡ ¾ø½À´Ï´Ù"));
- return;
- }
- char szSign[SHOP_SIGN_MAX_LEN+1];
- strlcpy(szSign, c_pszSign, sizeof(szSign));
- m_stShopSign = szSign;
- if (m_stShopSign.length() == 0)
- return;
- if (LC_IsCanada() == false)
- {
- if (CBanwordManager::instance().CheckString(m_stShopSign.c_str(), m_stShopSign.length()))
- {
- ChatPacket(CHAT_TYPE_INFO, LC_TEXT("ºñ¼Ó¾î³ª Àº¾î°¡ Æ÷ÇÔµÈ »óÁ¡ À̸§À¸·Î »óÁ¡À» ¿ ¼ö ¾ø½À´Ï´Ù."));
- return;
- }
- }
- // MYSHOP_PRICE_LIST
- std::map<DWORD, DWORD> itemkind; // ¾ÆÀÌÅÛ Á¾·ùº° °¡°Ý, first: vnum, second: ´ÜÀÏ ¼ö·® °¡°Ý
- // END_OF_MYSHOP_PRICE_LIST
- std::set<TItemPos> cont;
- for (BYTE i = 0; i < bItemCount; ++i)
- {
- if (cont.find((pTable + i)->pos) != cont.end())
- {
- sys_err("MYSHOP: duplicate shop item detected! (name: %s)", GetName());
- return;
- }
- // ANTI_GIVE, ANTI_MYSHOP check
- LPITEM pkItem = GetItem((pTable + i)->pos);
- if (pkItem)
- {
- const TItemTable * item_table = pkItem->GetProto();
- if (item_table && (IS_SET(item_table->dwAntiFlags, ITEM_ANTIFLAG_GIVE | ITEM_ANTIFLAG_MYSHOP)))
- {
- ChatPacket(CHAT_TYPE_INFO, LC_TEXT("À¯·áÈ ¾ÆÀÌÅÛÀº °³ÀλóÁ¡¿¡¼ ÆǸÅÇÒ ¼ö ¾ø½À´Ï´Ù."));
- return;
- }
- if (pkItem->IsEquipped() == true)
- {
- ChatPacket(CHAT_TYPE_INFO, LC_TEXT("ÀåºñÁßÀÎ ¾ÆÀÌÅÛÀº °³ÀλóÁ¡¿¡¼ ÆǸÅÇÒ ¼ö ¾ø½À´Ï´Ù."));
- return;
- }
- if (true == pkItem->isLocked())
- {
- ChatPacket(CHAT_TYPE_INFO, LC_TEXT("»ç¿ëÁßÀÎ ¾ÆÀÌÅÛÀº °³ÀλóÁ¡¿¡¼ ÆǸÅÇÒ ¼ö ¾ø½À´Ï´Ù."));
- return;
- }
- // MYSHOP_PRICE_LIST
- itemkind[pkItem->GetVnum()] = (pTable + i)->price / pkItem->GetCount();
- // END_OF_MYSHOP_PRICE_LIST
- }
- cont.insert((pTable + i)->pos);
- }
- // MYSHOP_PRICE_LIST
- // º¸µû¸® °³¼ö¸¦ °¨¼Ò½ÃŲ´Ù.
- if (CountSpecifyItem(71049)) { // ºñ´Ü º¸µû¸®´Â ¾ø¾ÖÁö ¾Ê°í °¡°ÝÁ¤º¸¸¦ ÀúÀåÇÑ´Ù.
- //
- // ¾ÆÀÌÅÛ °¡°ÝÁ¤º¸¸¦ ÀúÀåÇϱâ À§ÇØ ¾ÆÀÌÅÛ °¡°ÝÁ¤º¸ ÆÐŶÀ» ¸¸µé¾î DB ij½Ã¿¡ º¸³½´Ù.
- //
- TPacketMyshopPricelistHeader header;
- TItemPriceInfo info;
- header.dwOwnerID = GetPlayerID();
- header.byCount = itemkind.size();
- TEMP_BUFFER buf;
- buf.write(&header, sizeof(header));
- for (itertype(itemkind) it = itemkind.begin(); it != itemkind.end(); ++it)
- {
- info.dwVnum = it->first;
- info.dwPrice = it->second;
- buf.write(&info, sizeof(info));
- }
- db_clientdesc->DBPacket(HEADER_GD_MYSHOP_PRICELIST_UPDATE, 0, buf.read_peek(), buf.size());
- }
- // END_OF_MYSHOP_PRICE_LIST
- else if (CountSpecifyItem(50200))
- RemoveSpecifyItem(50200, 1);
- else
- return; // º¸µû¸®°¡ ¾øÀ¸¸é Áß´Ü.
- if (m_pkExchange)
- m_pkExchange->Cancel();
- TPacketGCShopSign p;
- p.bHeader = HEADER_GC_SHOP_SIGN;
- p.dwVID = GetVID();
- strlcpy(p.szSign, c_pszSign, sizeof(p.szSign));
- PacketAround(&p, sizeof(TPacketGCShopSign));
- m_pkMyShop = CShopManager::instance().CreatePCShop(this, pTable, bItemCount);
- if (IsPolymorphed() == true)
- {
- RemoveAffect(AFFECT_POLYMORPH);
- }
- if (GetHorse())
- {
- HorseSummon( false, true );
- }
- // new mount ÀÌ¿ë Áß¿¡, °³ÀÎ »óÁ¡ ¿¸é ÀÚµ¿ unmount
- // StopRidingÀ¸·Î ´º¸¶¿îÆ®±îÁö ó¸®Çϸé ÁÁÀºµ¥ ¿Ö ±×·¸°Ô ¾ÈÇسù´ÂÁö ¾Ë ¼ö ¾ø´Ù.
- else if (GetMountVnum())
- {
- RemoveAffect(AFFECT_MOUNT);
- RemoveAffect(AFFECT_MOUNT_BONUS);
- }
- //if (!LC_IsNewCIBN())
- SetPolymorph(30000, true);
- }
- void CHARACTER::CloseMyShop()
- {
- if (GetMyShop())
- {
- m_stShopSign.clear();
- CShopManager::instance().DestroyPCShop(this);
- m_pkMyShop = NULL;
- TPacketGCShopSign p;
- p.bHeader = HEADER_GC_SHOP_SIGN;
- p.dwVID = GetVID();
- p.szSign[0] = '\0';
- PacketAround(&p, sizeof(p));
- //if (!LC_IsNewCIBN())
- SetPolymorph(GetJob(), true);
- }
- }
- void EncodeMovePacket(TPacketGCMove & pack, DWORD dwVID, BYTE bFunc, BYTE bArg, DWORD x, DWORD y, DWORD dwDuration, DWORD dwTime, BYTE bRot)
- {
- pack.bHeader = HEADER_GC_MOVE;
- pack.bFunc = bFunc;
- pack.bArg = bArg;
- pack.dwVID = dwVID;
- pack.dwTime = dwTime ? dwTime : get_dword_time();
- pack.bRot = bRot;
- pack.lX = x;
- pack.lY = y;
- pack.dwDuration = dwDuration;
- }
- void CHARACTER::RestartAtSamePos()
- {
- if (m_bIsObserver)
- return;
- EncodeRemovePacket(this);
- EncodeInsertPacket(this);
- ENTITY_MAP::iterator it = m_map_view.begin();
- while (it != m_map_view.end())
- {
- LPENTITY entity = (it++)->first;
- EncodeRemovePacket(entity);
- if (!m_bIsObserver)
- EncodeInsertPacket(entity);
- if( entity->IsType(ENTITY_CHARACTER) )
- {
- LPCHARACTER lpChar = (LPCHARACTER)entity;
- if( lpChar->IsPC() || lpChar->IsNPC() || lpChar->IsMonster() )
- {
- if (!entity->IsObserverMode())
- entity->EncodeInsertPacket(this);
- }
- }
- else
- {
- if( !entity->IsObserverMode())
- {
- entity->EncodeInsertPacket(this);
- }
- }
- }
- }
- // Entity¿¡ ³»°¡ ³ªÅ¸³µ´Ù°í ÆÐŶÀ» º¸³½´Ù.
- void CHARACTER::EncodeInsertPacket(LPENTITY entity)
- {
- LPDESC d;
- if (!(d = entity->GetDesc()))
- return;
- // ±æµåÀ̸§ ¹ö±× ¼öÁ¤ ÄÚµå
- LPCHARACTER ch = (LPCHARACTER) entity;
- ch->SendGuildName(GetGuild());
- // ±æµåÀ̸§ ¹ö±× ¼öÁ¤ ÄÚµå
- TPacketGCCharacterAdd pack;
- pack.header = HEADER_GC_CHARACTER_ADD;
- pack.dwVID = m_vid;
- pack.bType = GetCharType();
- pack.angle = GetRotation();
- pack.x = GetX();
- pack.y = GetY();
- pack.z = GetZ();
- pack.wRaceNum = GetRaceNum();
- if (IsPet())
- {
- pack.bMovingSpeed = 150;
- }
- else
- {
- pack.bMovingSpeed = GetLimitPoint(POINT_MOV_SPEED);
- }
- pack.bAttackSpeed = GetLimitPoint(POINT_ATT_SPEED);
- pack.dwAffectFlag[0] = m_afAffectFlag.bits[0];
- pack.dwAffectFlag[1] = m_afAffectFlag.bits[1];
- pack.bStateFlag = m_bAddChrState;
- int iDur = 0;
- if (m_posDest.x != pack.x || m_posDest.y != pack.y)
- {
- iDur = (m_dwMoveStartTime + m_dwMoveDuration) - get_dword_time();
- if (iDur <= 0)
- {
- pack.x = m_posDest.x;
- pack.y = m_posDest.y;
- }
- }
- d->Packet(&pack, sizeof(pack));
- if (IsPC() == true || m_bCharType == CHAR_TYPE_NPC)
- {
- TPacketGCCharacterAdditionalInfo addPacket;
- memset(&addPacket, 0, sizeof(TPacketGCCharacterAdditionalInfo));
- addPacket.header = HEADER_GC_CHAR_ADDITIONAL_INFO;
- addPacket.dwVID = m_vid;
- addPacket.awPart[CHR_EQUIPPART_ARMOR] = GetPart(PART_MAIN);
- addPacket.awPart[CHR_EQUIPPART_WEAPON] = GetPart(PART_WEAPON);
- addPacket.awPart[CHR_EQUIPPART_HEAD] = GetPart(PART_HEAD);
- addPacket.awPart[CHR_EQUIPPART_HAIR] = GetPart(PART_HAIR);
- #ifdef __SASH_SYSTEM__
- addPacket.awPart[CHR_EQUIPPART_SASH] = GetPart(PART_SASH);
- #endif
- #ifdef __ITEM_SHINING__
- addPacket.adwShining[CHR_SHINING_WEAPON_1] = GetWear(WEAR_SHINING_WEAPON_1) ? GetWear(WEAR_SHINING_WEAPON_1)->GetVnum() : 0;
- addPacket.adwShining[CHR_SHINING_WEAPON_2] = GetWear(WEAR_SHINING_WEAPON_2) ? GetWear(WEAR_SHINING_WEAPON_2)->GetVnum() : 0;
- addPacket.adwShining[CHR_SHINING_WEAPON_3] = GetWear(WEAR_SHINING_WEAPON_3) ? GetWear(WEAR_SHINING_WEAPON_3)->GetVnum() : 0;
- addPacket.adwShining[CHR_SHINING_ARMOR_1] = GetWear(WEAR_SHINING_ARMOR_1) ? GetWear(WEAR_SHINING_ARMOR_1)->GetVnum() : 0;
- addPacket.adwShining[CHR_SHINING_ARMOR_2] = GetWear(WEAR_SHINING_ARMOR_2) ? GetWear(WEAR_SHINING_ARMOR_2)->GetVnum() : 0;
- addPacket.adwShining[CHR_SHINING_SPECIAL] = GetWear(WEAR_SHINING_SPECIAL) ? GetWear(WEAR_SHINING_SPECIAL)->GetVnum() : 0;
- #endif
- addPacket.bPKMode = m_bPKMode;
- addPacket.dwMountVnum = GetMountVnum();
- addPacket.bEmpire = m_bEmpire;
- if (IsPC() == true && (LC_IsEurope() == true || LC_IsCanada() == true || LC_IsSingapore() == true))
- {
- addPacket.dwLevel = GetLevel();
- #ifdef __PRESTIGE_SYSTEM__
- addPacket.bPrestige = GetPrestigeLevel();
- #endif
- }
- else
- {
- addPacket.dwLevel = 0;
- #ifdef __PRESTIGE_SYSTEM__
- addPacket.bPrestige = 0;
- #endif
- }
- if (false)
- {
- LPCHARACTER ch = (LPCHARACTER) entity;
- if (GetEmpire() == ch->GetEmpire() || ch->GetGMLevel() > GM_PLAYER || m_bCharType == CHAR_TYPE_NPC)
- {
- goto show_all_info;
- }
- else
- {
- memset(addPacket.name, 0, CHARACTER_NAME_MAX_LEN);
- addPacket.dwGuildID = 0;
- addPacket.sAlignment = 0;
- }
- }
- else
- {
- show_all_info:
- strlcpy(addPacket.name, GetName(), sizeof(addPacket.name));
- if (GetGuild() != NULL)
- {
- addPacket.dwGuildID = GetGuild()->GetID();
- }
- else
- {
- addPacket.dwGuildID = 0;
- }
- addPacket.sAlignment = m_iAlignment / 10;
- }
- d->Packet(&addPacket, sizeof(TPacketGCCharacterAdditionalInfo));
- }
- if (iDur)
- {
- TPacketGCMove pack;
- EncodeMovePacket(pack, GetVID(), FUNC_MOVE, 0, m_posDest.x, m_posDest.y, iDur, 0, (BYTE) (GetRotation() / 5));
- d->Packet(&pack, sizeof(pack));
- TPacketGCWalkMode p;
- p.vid = GetVID();
- p.header = HEADER_GC_WALK_MODE;
- p.mode = m_bNowWalking ? WALKMODE_WALK : WALKMODE_RUN;
- d->Packet(&p, sizeof(p));
- }
- if (entity->IsType(ENTITY_CHARACTER) && GetDesc())
- {
- LPCHARACTER ch = (LPCHARACTER) entity;
- if (ch->IsWalking())
- {
- TPacketGCWalkMode p;
- p.vid = ch->GetVID();
- p.header = HEADER_GC_WALK_MODE;
- p.mode = ch->m_bNowWalking ? WALKMODE_WALK : WALKMODE_RUN;
- GetDesc()->Packet(&p, sizeof(p));
- }
- }
- if (GetMyShop())
- {
- TPacketGCShopSign p;
- p.bHeader = HEADER_GC_SHOP_SIGN;
- p.dwVID = GetVID();
- strlcpy(p.szSign, m_stShopSign.c_str(), sizeof(p.szSign));
- d->Packet(&p, sizeof(TPacketGCShopSign));
- }
- if (entity->IsType(ENTITY_CHARACTER))
- {
- sys_log(3, "EntityInsert %s (RaceNum %d) (%d %d) TO %s",
- GetName(), GetRaceNum(), GetX() / SECTREE_SIZE, GetY() / SECTREE_SIZE, ((LPCHARACTER)entity)->GetName());
- }
- }
- void CHARACTER::EncodeRemovePacket(LPENTITY entity)
- {
- if (entity->GetType() != ENTITY_CHARACTER)
- return;
- LPDESC d;
- if (!(d = entity->GetDesc()))
- return;
- TPacketGCCharacterDelete pack;
- pack.header = HEADER_GC_CHARACTER_DEL;
- pack.id = m_vid;
- d->Packet(&pack, sizeof(TPacketGCCharacterDelete));
- if (entity->IsType(ENTITY_CHARACTER))
- sys_log(3, "EntityRemove %s(%d) FROM %s", GetName(), (DWORD) m_vid, ((LPCHARACTER) entity)->GetName());
- }
- void CHARACTER::UpdatePacket()
- {
- if (GetSectree() == NULL) return;
- TPacketGCCharacterUpdate pack;
- TPacketGCCharacterUpdate pack2;
- pack.header = HEADER_GC_CHARACTER_UPDATE;
- pack.dwVID = m_vid;
- pack.awPart[CHR_EQUIPPART_ARMOR] = GetPart(PART_MAIN);
- pack.awPart[CHR_EQUIPPART_WEAPON] = GetPart(PART_WEAPON);
- pack.awPart[CHR_EQUIPPART_HEAD] = GetPart(PART_HEAD);
- pack.awPart[CHR_EQUIPPART_HAIR] = GetPart(PART_HAIR);
- #ifdef __SASH_SYSTEM__
- pack.awPart[CHR_EQUIPPART_SASH] = GetPart(PART_SASH);
- #endif
- #ifdef __ITEM_SHINING__
- pack.adwShining[CHR_SHINING_WEAPON_1] = GetWear(WEAR_SHINING_WEAPON_1) ? GetWear(WEAR_SHINING_WEAPON_1)->GetVnum() : 0;
- pack.adwShining[CHR_SHINING_WEAPON_2] = GetWear(WEAR_SHINING_WEAPON_2) ? GetWear(WEAR_SHINING_WEAPON_2)->GetVnum() : 0;
- pack.adwShining[CHR_SHINING_WEAPON_3] = GetWear(WEAR_SHINING_WEAPON_3) ? GetWear(WEAR_SHINING_WEAPON_3)->GetVnum() : 0;
- pack.adwShining[CHR_SHINING_ARMOR_1] = GetWear(WEAR_SHINING_ARMOR_1) ? GetWear(WEAR_SHINING_ARMOR_1)->GetVnum() : 0;
- pack.adwShining[CHR_SHINING_ARMOR_2] = GetWear(WEAR_SHINING_ARMOR_2) ? GetWear(WEAR_SHINING_ARMOR_2)->GetVnum() : 0;
- pack.adwShining[CHR_SHINING_SPECIAL] = GetWear(WEAR_SHINING_SPECIAL) ? GetWear(WEAR_SHINING_SPECIAL)->GetVnum() : 0;
- #endif
- pack.bMovingSpeed = GetLimitPoint(POINT_MOV_SPEED);
- pack.bAttackSpeed = GetLimitPoint(POINT_ATT_SPEED);
- pack.bStateFlag = m_bAddChrState;
- pack.dwAffectFlag[0] = m_afAffectFlag.bits[0];
- pack.dwAffectFlag[1] = m_afAffectFlag.bits[1];
- pack.dwGuildID = 0;
- pack.sAlignment = m_iAlignment / 10;
- pack.bPKMode = m_bPKMode;
- #ifdef __PRESTIGE_SYSTEM__
- pack.bPrestige = GetPrestigeLevel();
- #endif
- if (GetGuild())
- pack.dwGuildID = GetGuild()->GetID();
- pack.dwMountVnum = GetMountVnum();
- pack2 = pack;
- pack2.dwGuildID = 0;
- pack2.sAlignment = 0;
- if (false)
- {
- if (m_bIsObserver != true)
- {
- for (ENTITY_MAP::iterator iter = m_map_view.begin(); iter != m_map_view.end(); iter++)
- {
- LPENTITY pEntity = iter->first;
- if (pEntity != NULL)
- {
- if (pEntity->IsType(ENTITY_CHARACTER) == true)
- {
- if (pEntity->GetDesc() != NULL)
- {
- LPCHARACTER pChar = (LPCHARACTER)pEntity;
- if (GetEmpire() == pChar->GetEmpire() || pChar->GetGMLevel() > GM_PLAYER)
- {
- pEntity->GetDesc()->Packet(&pack, sizeof(pack));
- }
- else
- {
- pEntity->GetDesc()->Packet(&pack2, sizeof(pack2));
- }
- }
- }
- else
- {
- if (pEntity->GetDesc() != NULL)
- {
- pEntity->GetDesc()->Packet(&pack, sizeof(pack));
- }
- }
- }
- }
- }
- if (GetDesc() != NULL)
- {
- GetDesc()->Packet(&pack, sizeof(pack));
- }
- }
- else
- {
- PacketAround(&pack, sizeof(pack));
- }
- }
- LPCHARACTER CHARACTER::FindCharacterInView(const char * c_pszName, bool bFindPCOnly)
- {
- ENTITY_MAP::iterator it = m_map_view.begin();
- for (; it != m_map_view.end(); ++it)
- {
- if (!it->first->IsType(ENTITY_CHARACTER))
- continue;
- LPCHARACTER tch = (LPCHARACTER) it->first;
- if (bFindPCOnly && tch->IsNPC())
- continue;
- if (!strcasecmp(tch->GetName(), c_pszName))
- return (tch);
- }
- return NULL;
- }
- void CHARACTER::SetPosition(int pos)
- {
- if (pos == POS_STANDING)
- {
- REMOVE_BIT(m_bAddChrState, ADD_CHARACTER_STATE_DEAD);
- REMOVE_BIT(m_pointsInstant.instant_flag, INSTANT_FLAG_STUN);
- event_cancel(&m_pkDeadEvent);
- event_cancel(&m_pkStunEvent);
- }
- else if (pos == POS_DEAD)
- SET_BIT(m_bAddChrState, ADD_CHARACTER_STATE_DEAD);
- if (!IsStone())
- {
- switch (pos)
- {
- case POS_FIGHTING:
- if (!IsState(m_stateBattle))
- MonsterLog("[BATTLE] ½Î¿ì´Â »óÅÂ");
- GotoState(m_stateBattle);
- break;
- default:
- if (!IsState(m_stateIdle))
- MonsterLog("[IDLE] ½¬´Â »óÅÂ");
- GotoState(m_stateIdle);
- break;
- }
- }
- m_pointsInstant.position = pos;
- }
- void CHARACTER::Save()
- {
- if (!m_bSkipSave)
- CHARACTER_MANAGER::instance().DelayedSave(this);
- }
- void CHARACTER::CreatePlayerProto(TPlayerTable & tab)
- {
- memset(&tab, 0, sizeof(TPlayerTable));
- if (GetNewName().empty())
- {
- strlcpy(tab.name, GetName(), sizeof(tab.name));
- }
- else
- {
- strlcpy(tab.name, GetNewName().c_str(), sizeof(tab.name));
- }
- strlcpy(tab.ip, GetDesc()->GetHostName(), sizeof(tab.ip));
- tab.id = m_dwPlayerID;
- tab.voice = GetPoint(POINT_VOICE);
- tab.level = GetLevel();
- tab.level_step = GetPoint(POINT_LEVEL_STEP);
- #ifdef __PRESTIGE_SYSTEM__
- tab.prestige = GetPrestigeLevel();
- #endif
- tab.exp = GetExp();
- tab.gold = GetGold();
- tab.job = m_points.job;
- tab.part_base = m_pointsInstant.bBasePart;
- tab.skill_group = m_points.skill_group;
- DWORD dwPlayedTime = (get_dword_time() - m_dwPlayStartTime);
- if (dwPlayedTime > 60000)
- {
- if (GetSectree() && !GetSectree()->IsAttr(GetX(), GetY(), ATTR_BANPK))
- {
- if (GetRealAlignment() < 0)
- {
- if (IsEquipUniqueItem(UNIQUE_ITEM_FASTER_ALIGNMENT_UP_BY_TIME))
- UpdateAlignment(120 * (dwPlayedTime / 60000));
- else
- UpdateAlignment(60 * (dwPlayedTime / 60000));
- }
- else
- UpdateAlignment(5 * (dwPlayedTime / 60000));
- }
- SetRealPoint(POINT_PLAYTIME, GetRealPoint(POINT_PLAYTIME) + dwPlayedTime / 60000);
- ResetPlayTime(dwPlayedTime % 60000);
- }
- tab.playtime = GetRealPoint(POINT_PLAYTIME);
- tab.lAlignment = m_iRealAlignment;
- if (m_posWarp.x != 0 || m_posWarp.y != 0)
- {
- tab.x = m_posWarp.x;
- tab.y = m_posWarp.y;
- tab.z = 0;
- tab.lMapIndex = m_lWarpMapIndex;
- }
- else
- {
- tab.x = GetX();
- tab.y = GetY();
- tab.z = GetZ();
- tab.lMapIndex = GetMapIndex();
- }
- if (m_lExitMapIndex == 0)
- {
- tab.lExitMapIndex = tab.lMapIndex;
- tab.lExitX = tab.x;
- tab.lExitY = tab.y;
- }
- else
- {
- tab.lExitMapIndex = m_lExitMapIndex;
- tab.lExitX = m_posExit.x;
- tab.lExitY = m_posExit.y;
- }
- sys_log(0, "SAVE: %s %dx%d", GetName(), tab.x, tab.y);
- tab.st = GetRealPoint(POINT_ST);
- tab.ht = GetRealPoint(POINT_HT);
- tab.dx = GetRealPoint(POINT_DX);
- tab.iq = GetRealPoint(POINT_IQ);
- tab.stat_point = GetPoint(POINT_STAT);
- tab.skill_point = GetPoint(POINT_SKILL);
- tab.sub_skill_point = GetPoint(POINT_SUB_SKILL);
- tab.horse_skill_point = GetPoint(POINT_HORSE_SKILL);
- tab.stat_reset_count = GetPoint(POINT_STAT_RESET_COUNT);
- tab.hp = GetHP();
- tab.sp = GetSP();
- tab.stamina = GetStamina();
- tab.sRandomHP = m_points.iRandomHP;
- tab.sRandomSP = m_points.iRandomSP;
- for (int i = 0; i < QUICKSLOT_MAX_NUM; ++i)
- tab.quickslot[i] = m_quickslot[i];
- if (m_stMobile.length() && !*m_szMobileAuth)
- strlcpy(tab.szMobile, m_stMobile.c_str(), sizeof(tab.szMobile));
- thecore_memcpy(tab.parts, m_pointsInstant.parts, sizeof(tab.parts));
- // REMOVE_REAL_SKILL_LEVLES
- thecore_memcpy(tab.skills, m_pSkillLevels, sizeof(TPlayerSkill) * SKILL_MAX_NUM);
- // END_OF_REMOVE_REAL_SKILL_LEVLES
- tab.horse = GetHorseData();
- }
- void CHARACTER::SaveReal()
- {
- if (m_bSkipSave)
- return;
- if (!GetDesc())
- {
- sys_err("Character::Save : no descriptor when saving (name: %s)", GetName());
- return;
- }
- TPlayerTable table;
- CreatePlayerProto(table);
- db_clientdesc->DBPacket(HEADER_GD_PLAYER_SAVE, GetDesc()->GetHandle(), &table, sizeof(TPlayerTable));
- quest::PC * pkQuestPC = quest::CQuestManager::instance().GetPCForce(GetPlayerID());
- if (!pkQuestPC)
- sys_err("CHARACTER::Save : null quest::PC pointer! (name %s)", GetName());
- else
- {
- pkQuestPC->Save();
- }
- marriage::TMarriage* pMarriage = marriage::CManager::instance().Get(GetPlayerID());
- if (pMarriage)
- pMarriage->Save();
- }
- void CHARACTER::FlushDelayedSaveItem()
- {
- // ÀúÀå ¾ÈµÈ ¼ÒÁöÇ°À» ÀüºÎ ÀúÀå½ÃŲ´Ù.
- LPITEM item;
- for (int i = 0; i < INVENTORY_AND_EQUIP_SLOT_MAX; ++i)
- if ((item = GetInventoryItem(i)))
- ITEM_MANAGER::instance().FlushDelayedSave(item);
- }
- void CHARACTER::Disconnect(const char * c_pszReason)
- {
- assert(GetDesc() != NULL);
- sys_log(0, "DISCONNECT: %s (%s)", GetName(), c_pszReason ? c_pszReason : "unset" );
- if (GetShop())
- {
- GetShop()->RemoveGuest(this);
- SetShop(NULL);
- }
- if (GetArena() != NULL)
- {
- GetArena()->OnDisconnect(GetPlayerID());
- }
- if (GetParty() != NULL)
- {
- GetParty()->UpdateOfflineState(GetPlayerID());
- }
- marriage::CManager::instance().Logout(this);
- // P2P Logout
- TPacketGGLogout p;
- p.bHeader = HEADER_GG_LOGOUT;
- strlcpy(p.szName, GetName(), sizeof(p.szName));
- P2P_MANAGER::instance().Send(&p, sizeof(TPacketGGLogout));
- char buf[51];
- snprintf(buf, sizeof(buf), "%s %d %d %ld %d",
- inet_ntoa(GetDesc()->GetAddr().sin_addr), GetGold(), g_bChannel, GetMapIndex(), GetAlignment());
- LogManager::instance().CharLog(this, 0, "LOGOUT", buf);
- if (LC_IsYMIR() || LC_IsKorea() || LC_IsBrazil())
- {
- long playTime = GetRealPoint(POINT_PLAYTIME) - m_dwLoginPlayTime;
- LogManager::instance().LoginLog(false, GetDesc()->GetAccountTable().id, GetPlayerID(), GetLevel(), GetJob(), playTime);
- if (LC_IsBrazil() != true)
- CPCBangManager::instance().Log(GetDesc()->GetHostName(), GetPlayerID(), playTime);
- }
- if (m_pWarMap)
- SetWarMap(NULL);
- if (m_pWeddingMap)
- {
- SetWeddingMap(NULL);
- }
- if (GetGuild())
- GetGuild()->LogoutMember(this);
- quest::CQuestManager::instance().LogoutPC(this);
- if (GetParty())
- GetParty()->Unlink(this);
- // Á×¾úÀ» ¶§ Á¢¼Ó²÷À¸¸é °æÇèÄ¡ ÁÙ°Ô Çϱâ
- if (IsStun() || IsDead())
- {
- DeathPenalty(0);
- PointChange(POINT_HP, 50 - GetHP());
- }
- if (!CHARACTER_MANAGER::instance().FlushDelayedSave(this))
- {
- SaveReal();
- }
- FlushDelayedSaveItem();
- SaveAffect();
- m_bIsLoadedAffect = false;
- m_bSkipSave = true; // ÀÌ ÀÌÈÄ¿¡´Â ´õÀÌ»ó ÀúÀåÇÏ¸é ¾ÈµÈ´Ù.
- quest::CQuestManager::instance().DisconnectPC(this);
- CloseSafebox();
- CloseMall();
- CPVPManager::instance().Disconnect(this);
- CTargetManager::instance().Logout(GetPlayerID());
- MessengerManager::instance().Logout(GetName());
- if (g_TeenDesc)
- {
- int offset = 0;
- char buf[245] = {0};
- buf[0] = HEADER_GT_LOGOUT;
- offset += 1;
- memset(buf+offset, 0x00, 2);
- offset += 2;
- TAccountTable &acc_table = GetDesc()->GetAccountTable();
- memcpy(buf+offset, &acc_table.id, 4);
- offset += 4;
- g_TeenDesc->Packet(buf, offset);
- }
- if (GetDesc())
- {
- GetDesc()->BindCharacter(NULL);
- // BindDesc(NULL);
- }
- CXTrapManager::instance().DestroyClientSession(this);
- M2_DESTROY_CHARACTER(this);
- }
- bool CHARACTER::Show(long lMapIndex, long x, long y, long z, bool bShowSpawnMotion/* = false */)
- {
- LPSECTREE sectree = SECTREE_MANAGER::instance().Get(lMapIndex, x, y);
- if (!sectree)
- {
- sys_log(0, "cannot find sectree by %dx%d mapindex %d", x, y, lMapIndex);
- return false;
- }
- SetMapIndex(lMapIndex);
- bool bChangeTree = false;
- if (!GetSectree() || GetSectree() != sectree)
- bChangeTree = true;
- if (bChangeTree)
- {
- if (GetSectree())
- GetSectree()->RemoveEntity(this);
- ViewCleanup();
- }
- if (!IsNPC())
- {
- sys_log(0, "SHOW: %s %dx%dx%d", GetName(), x, y, z);
- if (GetStamina() < GetMaxStamina())
- StartAffectEvent();
- }
- else if (m_pkMobData)
- {
- m_pkMobInst->m_posLastAttacked.x = x;
- m_pkMobInst->m_posLastAttacked.y = y;
- m_pkMobInst->m_posLastAttacked.z = z;
- }
- if (bShowSpawnMotion)
- {
- SET_BIT(m_bAddChrState, ADD_CHARACTER_STATE_SPAWN);
- m_afAffectFlag.Set(AFF_SPAWN);
- }
- SetXYZ(x, y, z);
- m_posDest.x = x;
- m_posDest.y = y;
- m_posDest.z = z;
- m_posStart.x = x;
- m_posStart.y = y;
- m_posStart.z = z;
- if (bChangeTree)
- {
- EncodeInsertPacket(this);
- sectree->InsertEntity(this);
- UpdateSectree();
- }
- else
- {
- ViewReencode();
- sys_log(0, " in same sectree");
- }
- REMOVE_BIT(m_bAddChrState, ADD_CHARACTER_STATE_SPAWN);
- SetValidComboInterval(0);
- return true;
- }
- // BGM_INFO
- struct BGMInfo
- {
- std::string name;
- float vol;
- };
- typedef std::map<unsigned, BGMInfo> BGMInfoMap;
- static BGMInfoMap gs_bgmInfoMap;
- static bool gs_bgmVolEnable = false;
- void CHARACTER_SetBGMVolumeEnable()
- {
- gs_bgmVolEnable = true;
- sys_log(0, "bgm_info.set_bgm_volume_enable");
- }
- void CHARACTER_AddBGMInfo(unsigned mapIndex, const char* name, float vol)
- {
- BGMInfo newInfo;
- newInfo.name = name;
- newInfo.vol = vol;
- gs_bgmInfoMap[mapIndex] = newInfo;
- sys_log(0, "bgm_info.add_info(%d, '%s', %f)", mapIndex, name, vol);
- }
- const BGMInfo& CHARACTER_GetBGMInfo(unsigned mapIndex)
- {
- BGMInfoMap::iterator f = gs_bgmInfoMap.find(mapIndex);
- if (gs_bgmInfoMap.end() == f)
- {
- static BGMInfo s_empty = {"", 0.0f};
- return s_empty;
- }
- return f->second;
- }
- bool CHARACTER_IsBGMVolumeEnable()
- {
- return gs_bgmVolEnable;
- }
- // END_OF_BGM_INFO
- void CHARACTER::MainCharacterPacket()
- {
- const unsigned mapIndex = GetMapIndex();
- const BGMInfo& bgmInfo = CHARACTER_GetBGMInfo(mapIndex);
- // SUPPORT_BGM
- if (!bgmInfo.name.empty())
- {
- if (CHARACTER_IsBGMVolumeEnable())
- {
- sys_log(1, "bgm_info.play_bgm_vol(%d, name='%s', vol=%f)", mapIndex, bgmInfo.name.c_str(), bgmInfo.vol);
- TPacketGCMainCharacter4_BGM_VOL mainChrPacket;
- mainChrPacket.header = HEADER_GC_MAIN_CHARACTER4_BGM_VOL;
- mainChrPacket.dwVID = m_vid;
- mainChrPacket.wRaceNum = GetRaceNum();
- mainChrPacket.lx = GetX();
- mainChrPacket.ly = GetY();
- mainChrPacket.lz = GetZ();
- mainChrPacket.empire = GetDesc()->GetEmpire();
- mainChrPacket.skill_group = GetSkillGroup();
- strlcpy(mainChrPacket.szChrName, GetName(), sizeof(mainChrPacket.szChrName));
- mainChrPacket.fBGMVol = bgmInfo.vol;
- strlcpy(mainChrPacket.szBGMName, bgmInfo.name.c_str(), sizeof(mainChrPacket.szBGMName));
- GetDesc()->Packet(&mainChrPacket, sizeof(TPacketGCMainCharacter4_BGM_VOL));
- }
- else
- {
- sys_log(1, "bgm_info.play(%d, '%s')", mapIndex, bgmInfo.name.c_str());
- TPacketGCMainCharacter3_BGM mainChrPacket;
- mainChrPacket.header = HEADER_GC_MAIN_CHARACTER3_BGM;
- mainChrPacket.dwVID = m_vid;
- mainChrPacket.wRaceNum = GetRaceNum();
- mainChrPacket.lx = GetX();
- mainChrPacket.ly = GetY();
- mainChrPacket.lz = GetZ();
- mainChrPacket.empire = GetDesc()->GetEmpire();
- mainChrPacket.skill_group = GetSkillGroup();
- strlcpy(mainChrPacket.szChrName, GetName(), sizeof(mainChrPacket.szChrName));
- strlcpy(mainChrPacket.szBGMName, bgmInfo.name.c_str(), sizeof(mainChrPacket.szBGMName));
- GetDesc()->Packet(&mainChrPacket, sizeof(TPacketGCMainCharacter3_BGM));
- }
- //if (m_stMobile.length())
- // ChatPacket(CHAT_TYPE_COMMAND, "sms");
- }
- // END_OF_SUPPORT_BGM
- else
- {
- sys_log(0, "bgm_info.play(%d, DEFAULT_BGM_NAME)", mapIndex);
- TPacketGCMainCharacter pack;
- pack.header = HEADER_GC_MAIN_CHARACTER;
- pack.dwVID = m_vid;
- pack.wRaceNum = GetRaceNum();
- pack.lx = GetX();
- pack.ly = GetY();
- pack.lz = GetZ();
- pack.empire = GetDesc()->GetEmpire();
- pack.skill_group = GetSkillGroup();
- strlcpy(pack.szName, GetName(), sizeof(pack.szName));
- GetDesc()->Packet(&pack, sizeof(TPacketGCMainCharacter));
- if (m_stMobile.length())
- ChatPacket(CHAT_TYPE_COMMAND, "sms");
- }
- }
- void CHARACTER::PointsPacket()
- {
- if (!GetDesc())
- return;
- TPacketGCPoints pack;
- pack.header = HEADER_GC_CHARACTER_POINTS;
- pack.points[POINT_LEVEL] = GetLevel();
- pack.points[POINT_EXP] = GetExp();
- pack.points[POINT_NEXT_EXP] = GetNextExp();
- pack.points[POINT_HP] = GetHP();
- pack.points[POINT_MAX_HP] = GetMaxHP();
- pack.points[POINT_SP] = GetSP();
- pack.points[POINT_MAX_SP] = GetMaxSP();
- pack.points[POINT_GOLD] = GetGold();
- pack.points[POINT_STAMINA] = GetStamina();
- pack.points[POINT_MAX_STAMINA] = GetMaxStamina();
- for (int i = POINT_ST; i < POINT_MAX_NUM; ++i)
- pack.points[i] = GetPoint(i);
- GetDesc()->Packet(&pack, sizeof(TPacketGCPoints));
- }
- bool CHARACTER::ChangeSex()
- {
- int src_race = GetRaceNum();
- switch (src_race)
- {
- case MAIN_RACE_WARRIOR_M:
- m_points.job = MAIN_RACE_WARRIOR_W;
- break;
- case MAIN_RACE_WARRIOR_W:
- m_points.job = MAIN_RACE_WARRIOR_M;
- break;
- case MAIN_RACE_ASSASSIN_M:
- m_points.job = MAIN_RACE_ASSASSIN_W;
- break;
- case MAIN_RACE_ASSASSIN_W:
- m_points.job = MAIN_RACE_ASSASSIN_M;
- break;
- case MAIN_RACE_SURA_M:
- m_points.job = MAIN_RACE_SURA_W;
- break;
- case MAIN_RACE_SURA_W:
- m_points.job = MAIN_RACE_SURA_M;
- break;
- case MAIN_RACE_SHAMAN_M:
- m_points.job = MAIN_RACE_SHAMAN_W;
- break;
- case MAIN_RACE_SHAMAN_W:
- m_points.job = MAIN_RACE_SHAMAN_M;
- break;
- default:
- sys_err("CHANGE_SEX: %s unknown race %d", GetName(), src_race);
- return false;
- }
- sys_log(0, "CHANGE_SEX: %s (%d -> %d)", GetName(), src_race, m_points.job);
- return true;
- }
- WORD CHARACTER::GetRaceNum() const
- {
- if (m_dwPolymorphRace)
- return m_dwPolymorphRace;
- if (m_pkMobData)
- return m_pkMobData->m_table.dwVnum;
- return m_points.job;
- }
- void CHARACTER::SetRace(BYTE race)
- {
- if (race >= MAIN_RACE_MAX_NUM)
- {
- sys_err("CHARACTER::SetRace(name=%s, race=%d).OUT_OF_RACE_RANGE", GetName(), race);
- return;
- }
- m_points.job = race;
- }
- BYTE CHARACTER::GetJob() const
- {
- unsigned race = m_points.job;
- unsigned job;
- if (RaceToJob(race, &job))
- return job;
- sys_err("CHARACTER::GetJob(name=%s, race=%d).OUT_OF_RACE_RANGE", GetName(), race);
- return JOB_WARRIOR;
- }
- void CHARACTER::SetLevel(BYTE level)
- {
- m_points.level = level;
- if (IsPC())
- {
- if (level < PK_PROTECT_LEVEL)
- SetPKMode(PK_MODE_PROTECT);
- else if (GetGMLevel() != GM_PLAYER)
- SetPKMode(PK_MODE_PROTECT);
- else if (m_bPKMode == PK_MODE_PROTECT)
- SetPKMode(PK_MODE_PEACE);
- }
- }
- void CHARACTER::SetEmpire(BYTE bEmpire)
- {
- m_bEmpire = bEmpire;
- }
- void CHARACTER::SetPlayerProto(const TPlayerTable * t)
- {
- if (!GetDesc() || !*GetDesc()->GetHostName())
- sys_err("cannot get desc or hostname");
- else
- SetGMLevel();
- m_bCharType = CHAR_TYPE_PC;
- m_dwPlayerID = t->id;
- m_iAlignment = t->lAlignment;
- m_iRealAlignment = t->lAlignment;
- m_points.voice = t->voice;
- m_points.skill_group = t->skill_group;
- m_pointsInstant.bBasePart = t->part_base;
- SetPart(PART_HAIR, t->parts[PART_HAIR]);
- #ifdef __SASH_SYSTEM__
- SetPart(PART_SASH, t->parts[PART_SASH]);
- #endif
- m_points.iRandomHP = t->sRandomHP;
- m_points.iRandomSP = t->sRandomSP;
- // REMOVE_REAL_SKILL_LEVLES
- if (m_pSkillLevels)
- M2_DELETE_ARRAY(m_pSkillLevels);
- m_pSkillLevels = M2_NEW TPlayerSkill[SKILL_MAX_NUM];
- thecore_memcpy(m_pSkillLevels, t->skills, sizeof(TPlayerSkill) * SKILL_MAX_NUM);
- // END_OF_REMOVE_REAL_SKILL_LEVLES
- if (t->lMapIndex >= 10000)
- {
- m_posWarp.x = t->lExitX;
- m_posWarp.y = t->lExitY;
- m_lWarpMapIndex = t->lExitMapIndex;
- }
- SetRealPoint(POINT_PLAYTIME, t->playtime);
- m_dwLoginPlayTime = t->playtime;
- SetRealPoint(POINT_ST, t->st);
- SetRealPoint(POINT_HT, t->ht);
- SetRealPoint(POINT_DX, t->dx);
- SetRealPoint(POINT_IQ, t->iq);
- SetPoint(POINT_ST, t->st);
- SetPoint(POINT_HT, t->ht);
- SetPoint(POINT_DX, t->dx);
- SetPoint(POINT_IQ, t->iq);
- SetPoint(POINT_STAT, t->stat_point);
- SetPoint(POINT_SKILL, t->skill_point);
- SetPoint(POINT_SUB_SKILL, t->sub_skill_point);
- SetPoint(POINT_HORSE_SKILL, t->horse_skill_point);
- SetPoint(POINT_STAT_RESET_COUNT, t->stat_reset_count);
- SetPoint(POINT_LEVEL_STEP, t->level_step);
- SetRealPoint(POINT_LEVEL_STEP, t->level_step);
- SetRace(t->job);
- SetLevel(t->level);
- #ifdef __PRESTIGE_SYSTEM__
- SetPrestigeLevel(t->prestige);
- #endif
- SetExp(t->exp);
- SetGold(t->gold);
- SetMapIndex(t->lMapIndex);
- SetXYZ(t->x, t->y, t->z);
- ComputePoints();
- SetHP(t->hp);
- SetSP(t->sp);
- SetStamina(t->stamina);
- //GMÀ϶§ º¸È£¸ðµå
- if (!test_server)
- {
- if (GetGMLevel() > GM_LOW_WIZARD)
- {
- m_afAffectFlag.Set(AFF_YMIR);
- m_bPKMode = PK_MODE_PROTECT;
- }
- }
- if (GetLevel() < PK_PROTECT_LEVEL)
- m_bPKMode = PK_MODE_PROTECT;
- m_stMobile = t->szMobile;
- SetHorseData(t->horse);
- if (GetHorseLevel() > 0)
- UpdateHorseDataByLogoff(t->logoff_interval);
- thecore_memcpy(m_aiPremiumTimes, t->aiPremiumTimes, sizeof(t->aiPremiumTimes));
- m_dwLogOffInterval = t->logoff_interval;
- sys_log(0, "PLAYER_LOAD: %s PREMIUM %d %d, LOGGOFF_INTERVAL %u PTR: %p", t->name, m_aiPremiumTimes[0], m_aiPremiumTimes[1], t->logoff_interval, this);
- if (GetGMLevel() != GM_PLAYER)
- {
- LogManager::instance().CharLog(this, GetGMLevel(), "GM_LOGIN", "");
- sys_log(0, "GM_LOGIN(gmlevel=%d, name=%s(%d), pos=(%d, %d)", GetGMLevel(), GetName(), GetPlayerID(), GetX(), GetY());
- }
- #ifdef __PET_SYSTEM__
- // NOTE: ÀÏ´Ü Ä³¸¯ÅÍ°¡ PCÀÎ °æ¿ì¿¡¸¸ PetSystemÀ» °®µµ·Ï ÇÔ. À¯·´ ¸Ó½Å´ç ¸Þ¸ð¸® »ç¿ë·ü¶§¹®¿¡ NPC±îÁö Çϱä Á»..
- if (m_petSystem)
- {
- m_petSystem->Destroy();
- delete m_petSystem;
- }
- m_petSystem = M2_NEW CPetSystem(this);
- #endif
- }
- EVENTFUNC(kill_ore_load_event)
- {
- char_event_info* info = dynamic_cast<char_event_info*>( event->info );
- if ( info == NULL )
- {
- sys_err( "kill_ore_load_even> <Factor> Null pointer" );
- return 0;
- }
- LPCHARACTER ch = info->ch;
- if (ch == NULL) { // <Factor>
- return 0;
- }
- ch->m_pkMiningEvent = NULL;
- M2_DESTROY_CHARACTER(ch);
- return 0;
- }
- void CHARACTER::SetProto(const CMob * pkMob)
- {
- if (m_pkMobInst)
- M2_DELETE(m_pkMobInst);
- m_pkMobData = pkMob;
- m_pkMobInst = M2_NEW CMobInstance;
- m_bPKMode = PK_MODE_FREE;
- const TMobTable * t = &m_pkMobData->m_table;
- m_bCharType = t->bType;
- SetLevel(t->bLevel);
- SetEmpire(t->bEmpire);
- SetExp(t->dwExp);
- SetRealPoint(POINT_ST, t->bStr);
- SetRealPoint(POINT_DX, t->bDex);
- SetRealPoint(POINT_HT, t->bCon);
- SetRealPoint(POINT_IQ, t->bInt);
- ComputePoints();
- SetHP(GetMaxHP());
- SetSP(GetMaxSP());
- ////////////////////
- m_pointsInstant.dwAIFlag = t->dwAIFlag;
- SetImmuneFlag(t->dwImmuneFlag);
- AssignTriggers(t);
- ApplyMobAttribute(t);
- if (IsStone())
- {
- DetermineDropMetinStone();
- }
- if (IsWarp() || IsGoto())
- {
- StartWarpNPCEvent();
- }
- CHARACTER_MANAGER::instance().RegisterRaceNumMap(this);
- // XXX X-mas santa hardcoding
- if (GetRaceNum() == xmas::MOB_SANTA_VNUM)
- {
- SetPoint(POINT_ATT_GRADE_BONUS, 10);
- if (g_iUseLocale)
- SetPoint(POINT_DEF_GRADE_BONUS, 6);
- else
- SetPoint(POINT_DEF_GRADE_BONUS, 15);
- //»êŸ¿ë
- //m_dwPlayStartTime = get_dword_time() + 10 * 60 * 1000;
- //½Å¼±ÀÚ ³ëÇØ
- m_dwPlayStartTime = get_dword_time() + 30 * 1000;
- if (test_server)
- m_dwPlayStartTime = get_dword_time() + 30 * 1000;
- }
- // XXX CTF GuildWar hardcoding
- if (warmap::IsWarFlag(GetRaceNum()))
- {
- m_stateIdle.Set(this, &CHARACTER::BeginStateEmpty, &CHARACTER::StateFlag, &CHARACTER::EndStateEmpty);
- m_stateMove.Set(this, &CHARACTER::BeginStateEmpty, &CHARACTER::StateFlag, &CHARACTER::EndStateEmpty);
- m_stateBattle.Set(this, &CHARACTER::BeginStateEmpty, &CHARACTER::StateFlag, &CHARACTER::EndStateEmpty);
- }
- if (warmap::IsWarFlagBase(GetRaceNum()))
- {
- m_stateIdle.Set(this, &CHARACTER::BeginStateEmpty, &CHARACTER::StateFlagBase, &CHARACTER::EndStateEmpty);
- m_stateMove.Set(this, &CHARACTER::BeginStateEmpty, &CHARACTER::StateFlagBase, &CHARACTER::EndStateEmpty);
- m_stateBattle.Set(this, &CHARACTER::BeginStateEmpty, &CHARACTER::StateFlagBase, &CHARACTER::EndStateEmpty);
- }
- if (m_bCharType == CHAR_TYPE_HORSE ||
- GetRaceNum() == 20101 ||
- GetRaceNum() == 20102 ||
- GetRaceNum() == 20103 ||
- GetRaceNum() == 20104 ||
- GetRaceNum() == 20105 ||
- GetRaceNum() == 20106 ||
- GetRaceNum() == 20107 ||
- GetRaceNum() == 20108 ||
- GetRaceNum() == 20109
- )
- {
- m_stateIdle.Set(this, &CHARACTER::BeginStateEmpty, &CHARACTER::StateHorse, &CHARACTER::EndStateEmpty);
- m_stateMove.Set(this, &CHARACTER::BeginStateEmpty, &CHARACTER::StateMove, &CHARACTER::EndStateEmpty);
- m_stateBattle.Set(this, &CHARACTER::BeginStateEmpty, &CHARACTER::StateHorse, &CHARACTER::EndStateEmpty);
- }
- // MINING
- if (mining::IsVeinOfOre (GetRaceNum()))
- {
- char_event_info* info = AllocEventInfo<char_event_info>();
- info->ch = this;
- m_pkMiningEvent = event_create(kill_ore_load_event, info, PASSES_PER_SEC(number(7 * 60, 15 * 60)));
- }
- // END_OF_MINING
- }
- const TMobTable & CHARACTER::GetMobTable() const
- {
- return m_pkMobData->m_table;
- }
- bool CHARACTER::IsRaceFlag(DWORD dwBit) const
- {
- return m_pkMobData ? IS_SET(m_pkMobData->m_table.dwRaceFlag, dwBit) : 0;
- }
- DWORD CHARACTER::GetMobDamageMin() const
- {
- return m_pkMobData->m_table.dwDamageRange[0];
- }
- DWORD CHARACTER::GetMobDamageMax() const
- {
- return m_pkMobData->m_table.dwDamageRange[1];
- }
- float CHARACTER::GetMobDamageMultiply() const
- {
- float fDamMultiply = GetMobTable().fDamMultiply;
- if (IsBerserk())
- fDamMultiply = fDamMultiply * 2.0f; // BALANCE: ±¤ÆøÈ ½Ã µÎ¹è
- return fDamMultiply;
- }
- DWORD CHARACTER::GetMobDropItemVnum() const
- {
- return m_pkMobData->m_table.dwDropItemVnum;
- }
- bool CHARACTER::IsSummonMonster() const
- {
- return GetSummonVnum() != 0;
- }
- DWORD CHARACTER::GetSummonVnum() const
- {
- return m_pkMobData ? m_pkMobData->m_table.dwSummonVnum : 0;
- }
- DWORD CHARACTER::GetPolymorphItemVnum() const
- {
- return m_pkMobData ? m_pkMobData->m_table.dwPolymorphItemVnum : 0;
- }
- DWORD CHARACTER::GetMonsterDrainSPPoint() const
- {
- return m_pkMobData ? m_pkMobData->m_table.dwDrainSP : 0;
- }
- BYTE CHARACTER::GetMobRank() const
- {
- if (!m_pkMobData)
- return MOB_RANK_KNIGHT; // PCÀÏ °æ¿ì KNIGHT±Þ
- return m_pkMobData->m_table.bRank;
- }
- BYTE CHARACTER::GetMobSize() const
- {
- if (!m_pkMobData)
- return MOBSIZE_MEDIUM;
- return m_pkMobData->m_table.bSize;
- }
- WORD CHARACTER::GetMobAttackRange() const
- {
- switch (GetMobBattleType())
- {
- case BATTLE_TYPE_RANGE:
- case BATTLE_TYPE_MAGIC:
- return m_pkMobData->m_table.wAttackRange + GetPoint(POINT_BOW_DISTANCE);
- default:
- return m_pkMobData->m_table.wAttackRange;
- }
- }
- BYTE CHARACTER::GetMobBattleType() const
- {
- if (!m_pkMobData)
- return BATTLE_TYPE_MELEE;
- return (m_pkMobData->m_table.bBattleType);
- }
- void CHARACTER::ComputeBattlePoints()
- {
- if (IsPolymorphed())
- {
- DWORD dwMobVnum = GetPolymorphVnum();
- const CMob * pMob = CMobManager::instance().Get(dwMobVnum);
- int iAtt = 0;
- int iDef = 0;
- if (pMob)
- {
- iAtt = GetLevel() * 2 + GetPolymorphPoint(POINT_ST) * 2;
- // lev + con
- iDef = GetLevel() + GetPolymorphPoint(POINT_HT) + pMob->m_table.wDef;
- }
- SetPoint(POINT_ATT_GRADE, iAtt);
- SetPoint(POINT_DEF_GRADE, iDef);
- SetPoint(POINT_MAGIC_ATT_GRADE, GetPoint(POINT_ATT_GRADE));
- SetPoint(POINT_MAGIC_DEF_GRADE, GetPoint(POINT_DEF_GRADE));
- }
- else if (IsPC())
- {
- SetPoint(POINT_ATT_GRADE, 0);
- SetPoint(POINT_DEF_GRADE, 0);
- SetPoint(POINT_CLIENT_DEF_GRADE, 0);
- SetPoint(POINT_MAGIC_ATT_GRADE, GetPoint(POINT_ATT_GRADE));
- SetPoint(POINT_MAGIC_DEF_GRADE, GetPoint(POINT_DEF_GRADE));
- //
- // ±âº» ATK = 2lev + 2str, Á÷¾÷¿¡ ¸¶´Ù 2strÀº ¹Ù²ð ¼ö ÀÖÀ½
- //
- int iAtk = GetLevel() * 2;
- int iStatAtk = 0;
- switch (GetJob())
- {
- case JOB_WARRIOR:
- case JOB_SURA:
- iStatAtk = (2 * GetPoint(POINT_ST));
- break;
- case JOB_ASSASSIN:
- iStatAtk = (4 * GetPoint(POINT_ST) + 2 * GetPoint(POINT_DX)) / 3;
- break;
- case JOB_SHAMAN:
- iStatAtk = (4 * GetPoint(POINT_ST) + 2 * GetPoint(POINT_IQ)) / 3;
- break;
- default:
- sys_err("invalid job %d", GetJob());
- iStatAtk = (2 * GetPoint(POINT_ST));
- break;
- }
- // ¸»À» Ÿ°í ÀÖ°í, ½ºÅÈÀ¸·Î ÀÎÇÑ °ø°Ý·ÂÀÌ ST*2 º¸´Ù ³·À¸¸é ST*2·Î ÇÑ´Ù.
- // ½ºÅÈÀ» À߸ø ÂïÀº »ç¶÷ °ø°Ý·ÂÀÌ ´õ ³·Áö ¾Ê°Ô Çϱâ À§Çؼ´Ù.
- if (GetMountVnum() && iStatAtk < 2 * GetPoint(POINT_ST))
- iStatAtk = (2 * GetPoint(POINT_ST));
- iAtk += iStatAtk;
- // ½Â¸¶(¸») : °Ë¼ö¶ó µ¥¹ÌÁö °¨¼Ò
- if (GetMountVnum())
- {
- if (GetJob() == JOB_SURA && GetSkillGroup() == 1)
- {
- iAtk += (iAtk * GetHorseLevel()) / 60;
- }
- else
- {
- iAtk += (iAtk * GetHorseLevel()) / 30;
- }
- }
- //
- // ATK Setting
- //
- iAtk += GetPoint(POINT_ATT_GRADE_BONUS);
- PointChange(POINT_ATT_GRADE, iAtk);
- // DEF = LEV + CON + ARMOR
- int iShowDef = GetLevel() + GetPoint(POINT_HT); // For Ymir(õ¸¶)
- int iDef = GetLevel() + (int) (GetPoint(POINT_HT) / 1.25); // For Other
- int iArmor = 0;
- LPITEM pkItem;
- for (int i = 0; i < WEAR_MAX_NUM; ++i)
- if ((pkItem = GetWear(i)) && pkItem->GetType() == ITEM_ARMOR)
- {
- if (pkItem->GetSubType() == ARMOR_BODY || pkItem->GetSubType() == ARMOR_HEAD || pkItem->GetSubType() == ARMOR_FOOTS || pkItem->GetSubType() == ARMOR_SHIELD)
- {
- iArmor += pkItem->GetValue(1);
- iArmor += (2 * pkItem->GetValue(5));
- }
- }
- // ¸» Ÿ°í ÀÖÀ» ¶§ ¹æ¾î·ÂÀÌ ¸»ÀÇ ±âÁØ ¹æ¾î·Âº¸´Ù ³·À¸¸é ±âÁØ ¹æ¾î·ÂÀ¸·Î ¼³Á¤
- if( true == IsHorseRiding() )
- {
- if (iArmor < GetHorseArmor())
- iArmor = GetHorseArmor();
- const char* pHorseName = CHorseNameManager::instance().GetHorseName(GetPlayerID());
- if (pHorseName != NULL && strlen(pHorseName))
- {
- iArmor += 20;
- }
- }
- iArmor += GetPoint(POINT_DEF_GRADE_BONUS);
- iArmor += GetPoint(POINT_PARTY_DEFENDER_BONUS);
- // INTERNATIONAL_VERSION
- if (LC_IsYMIR())
- {
- PointChange(POINT_DEF_GRADE, iShowDef + iArmor);
- }
- else
- {
- PointChange(POINT_DEF_GRADE, iDef + iArmor);
- PointChange(POINT_CLIENT_DEF_GRADE, (iShowDef + iArmor) - GetPoint(POINT_DEF_GRADE));
- }
- // END_OF_INTERNATIONAL_VERSION
- PointChange(POINT_MAGIC_ATT_GRADE, GetLevel() * 2 + GetPoint(POINT_IQ) * 2 + GetPoint(POINT_MAGIC_ATT_GRADE_BONUS));
- PointChange(POINT_MAGIC_DEF_GRADE, GetLevel() + (GetPoint(POINT_IQ) * 3 + GetPoint(POINT_HT)) / 3 + iArmor / 2 + GetPoint(POINT_MAGIC_DEF_GRADE_BONUS));
- }
- else
- {
- // 2lev + str * 2
- int iAtt = GetLevel() * 2 + GetPoint(POINT_ST) * 2;
- // lev + con
- int iDef = GetLevel() + GetPoint(POINT_HT) + GetMobTable().wDef;
- SetPoint(POINT_ATT_GRADE, iAtt);
- SetPoint(POINT_DEF_GRADE, iDef);
- SetPoint(POINT_MAGIC_ATT_GRADE, GetPoint(POINT_ATT_GRADE));
- SetPoint(POINT_MAGIC_DEF_GRADE, GetPoint(POINT_DEF_GRADE));
- }
- }
- void CHARACTER::ComputePoints()
- {
- long lStat = GetPoint(POINT_STAT);
- long lStatResetCount = GetPoint(POINT_STAT_RESET_COUNT);
- long lSkillActive = GetPoint(POINT_SKILL);
- long lSkillSub = GetPoint(POINT_SUB_SKILL);
- long lSkillHorse = GetPoint(POINT_HORSE_SKILL);
- long lLevelStep = GetPoint(POINT_LEVEL_STEP);
- long lAttackerBonus = GetPoint(POINT_PARTY_ATTACKER_BONUS);
- long lTankerBonus = GetPoint(POINT_PARTY_TANKER_BONUS);
- long lBufferBonus = GetPoint(POINT_PARTY_BUFFER_BONUS);
- long lSkillMasterBonus = GetPoint(POINT_PARTY_SKILL_MASTER_BONUS);
- long lHasteBonus = GetPoint(POINT_PARTY_HASTE_BONUS);
- long lDefenderBonus = GetPoint(POINT_PARTY_DEFENDER_BONUS);
- long lHPRecovery = GetPoint(POINT_HP_RECOVERY);
- long lSPRecovery = GetPoint(POINT_SP_RECOVERY);
- memset(m_pointsInstant.points, 0, sizeof(m_pointsInstant.points));
- BuffOnAttr_ClearAll();
- m_SkillDamageBonus.clear();
- SetPoint(POINT_STAT, lStat);
- SetPoint(POINT_SKILL, lSkillActive);
- SetPoint(POINT_SUB_SKILL, lSkillSub);
- SetPoint(POINT_HORSE_SKILL, lSkillHorse);
- SetPoint(POINT_LEVEL_STEP, lLevelStep);
- SetPoint(POINT_STAT_RESET_COUNT, lStatResetCount);
- SetPoint(POINT_ST, GetRealPoint(POINT_ST));
- SetPoint(POINT_HT, GetRealPoint(POINT_HT));
- SetPoint(POINT_DX, GetRealPoint(POINT_DX));
- SetPoint(POINT_IQ, GetRealPoint(POINT_IQ));
- SetPart(PART_MAIN, GetOriginalPart(PART_MAIN));
- SetPart(PART_WEAPON, GetOriginalPart(PART_WEAPON));
- SetPart(PART_HEAD, GetOriginalPart(PART_HEAD));
- SetPart(PART_HAIR, GetOriginalPart(PART_HAIR));
- #ifdef __SASH_SYSTEM__
- SetPart(PART_SASH, GetOriginalPart(PART_SASH));
- #endif
- SetPoint(POINT_PARTY_ATTACKER_BONUS, lAttackerBonus);
- SetPoint(POINT_PARTY_TANKER_BONUS, lTankerBonus);
- SetPoint(POINT_PARTY_BUFFER_BONUS, lBufferBonus);
- SetPoint(POINT_PARTY_SKILL_MASTER_BONUS, lSkillMasterBonus);
- SetPoint(POINT_PARTY_HASTE_BONUS, lHasteBonus);
- SetPoint(POINT_PARTY_DEFENDER_BONUS, lDefenderBonus);
- SetPoint(POINT_HP_RECOVERY, lHPRecovery);
- SetPoint(POINT_SP_RECOVERY, lSPRecovery);
- // PC_BANG_ITEM_ADD
- SetPoint(POINT_PC_BANG_EXP_BONUS, 0);
- SetPoint(POINT_PC_BANG_DROP_BONUS, 0);
- // END_PC_BANG_ITEM_ADD
- int iMaxHP, iMaxSP;
- int iMaxStamina;
- if (IsPC())
- {
- // ÃÖ´ë »ý¸í·Â/Á¤½Å·Â
- iMaxHP = JobInitialPoints[GetJob()].max_hp + m_points.iRandomHP + GetPoint(POINT_HT) * JobInitialPoints[GetJob()].hp_per_ht;
- iMaxSP = JobInitialPoints[GetJob()].max_sp + m_points.iRandomSP + GetPoint(POINT_IQ) * JobInitialPoints[GetJob()].sp_per_iq;
- iMaxStamina = JobInitialPoints[GetJob()].max_stamina + GetPoint(POINT_HT) * JobInitialPoints[GetJob()].stamina_per_con;
- {
- CSkillProto* pkSk = CSkillManager::instance().Get(SKILL_ADD_HP);
- if (NULL != pkSk)
- {
- pkSk->SetPointVar("k", 1.0f * GetSkillPower(SKILL_ADD_HP) / 100.0f);
- iMaxHP += static_cast<int>(pkSk->kPointPoly.Eval());
- }
- }
- // ±âº» °ªµé
- SetPoint(POINT_MOV_SPEED, 100);
- SetPoint(POINT_ATT_SPEED, 100);
- PointChange(POINT_ATT_SPEED, GetPoint(POINT_PARTY_HASTE_BONUS));
- SetPoint(POINT_CASTING_SPEED, 100);
- }
- else
- {
- iMaxHP = m_pkMobData->m_table.dwMaxHP;
- iMaxSP = 0;
- iMaxStamina = 0;
- SetPoint(POINT_ATT_SPEED, m_pkMobData->m_table.sAttackSpeed);
- SetPoint(POINT_MOV_SPEED, m_pkMobData->m_table.sMovingSpeed);
- SetPoint(POINT_CASTING_SPEED, m_pkMobData->m_table.sAttackSpeed);
- }
- if (IsPC())
- {
- // ¸» Ÿ°í ÀÖÀ» ¶§´Â ±âº» ½ºÅÈÀÌ ¸»ÀÇ ±âÁØ ½ºÅȺ¸´Ù ³·À¸¸é ³ô°Ô ¸¸µç´Ù.
- // µû¶ó¼ ¸»ÀÇ ±âÁØ ½ºÅÈÀÌ ¹«»ç ±âÁØÀ̹ǷÎ, ¼ö¶ó/¹«´çÀº Àüü ½ºÅÈ ÇÕÀÌ
- // ´ëäÀûÀ¸·Î ´õ ¿Ã¶ó°¡°Ô µÉ °ÍÀÌ´Ù.
- if (GetMountVnum())
- {
- if (GetHorseST() > GetPoint(POINT_ST))
- PointChange(POINT_ST, GetHorseST() - GetPoint(POINT_ST));
- if (GetHorseDX() > GetPoint(POINT_DX))
- PointChange(POINT_DX, GetHorseDX() - GetPoint(POINT_DX));
- if (GetHorseHT() > GetPoint(POINT_HT))
- PointChange(POINT_HT, GetHorseHT() - GetPoint(POINT_HT));
- if (GetHorseIQ() > GetPoint(POINT_IQ))
- PointChange(POINT_IQ, GetHorseIQ() - GetPoint(POINT_IQ));
- }
- }
- ComputeBattlePoints();
- // ±âº» HP/SP ¼³Á¤
- if (iMaxHP != GetMaxHP())
- {
- SetRealPoint(POINT_MAX_HP, iMaxHP); // ±âº»HP¸¦ RealPoint¿¡ ÀúÀåÇØ ³õ´Â´Ù.
- }
- PointChange(POINT_MAX_HP, 0);
- if (iMaxSP != GetMaxSP())
- {
- SetRealPoint(POINT_MAX_SP, iMaxSP); // ±âº»SP¸¦ RealPoint¿¡ ÀúÀåÇØ ³õ´Â´Ù.
- }
- PointChange(POINT_MAX_SP, 0);
- SetMaxStamina(iMaxStamina);
- m_pointsInstant.dwImmuneFlag = 0;
- for (int i = 0 ; i < WEAR_MAX_NUM; i++)
- {
- LPITEM pItem = GetWear(i);
- if (pItem)
- {
- pItem->ModifyPoints(true);
- SET_BIT(m_pointsInstant.dwImmuneFlag, GetWear(i)->GetImmuneFlag());
- }
- }
- // ¿ëÈ¥¼® ½Ã½ºÅÛ
- // ComputePoints¿¡¼´Â Äɸ¯ÅÍÀÇ ¸ðµç ¼Ó¼º°ªÀ» ÃʱâÈÇÏ°í,
- // ¾ÆÀÌÅÛ, ¹öÇÁ µî¿¡ °ü·ÃµÈ ¸ðµç ¼Ó¼º°ªÀ» Àç°è»êÇϱ⠶§¹®¿¡,
- // ¿ëÈ¥¼® ½Ã½ºÅÛµµ ActiveDeck¿¡ ÀÖ´Â ¸ðµç ¿ëÈ¥¼®ÀÇ ¼Ó¼º°ªÀ» ´Ù½Ã Àû¿ë½ÃÄÑ¾ß ÇÑ´Ù.
- if (DragonSoul_IsDeckActivated())
- {
- for (int i = WEAR_MAX_NUM + DS_SLOT_MAX * DragonSoul_GetActiveDeck();
- i < WEAR_MAX_NUM + DS_SLOT_MAX * (DragonSoul_GetActiveDeck() + 1); i++)
- {
- LPITEM pItem = GetWear(i);
- if (pItem)
- {
- if (DSManager::instance().IsTimeLeftDragonSoul(pItem))
- pItem->ModifyPoints(true);
- }
- }
- }
- if (GetHP() > GetMaxHP())
- PointChange(POINT_HP, GetMaxHP() - GetHP());
- if (GetSP() > GetMaxSP())
- PointChange(POINT_SP, GetMaxSP() - GetSP());
- ComputeSkillPoints();
- RefreshAffect();
- CPetSystem* pPetSystem = GetPetSystem();
- if (NULL != pPetSystem)
- {
- pPetSystem->RefreshBuff();
- }
- for (TMapBuffOnAttrs::iterator it = m_map_buff_on_attrs.begin(); it != m_map_buff_on_attrs.end(); it++)
- {
- it->second->GiveAllAttributes();
- }
- UpdatePacket();
- }
- // m_dwPlayStartTimeÀÇ ´ÜÀ§´Â milisecond´Ù. µ¥ÀÌÅͺ£À̽º¿¡´Â ºÐ´ÜÀ§·Î ±â·ÏÇϱâ
- // ¶§¹®¿¡ Ç÷¹À̽ð£À» °è»êÇÒ ¶§ / 60000 À¸·Î ³ª´²¼ Çϴµ¥, ±× ³ª¸ÓÁö °ªÀÌ ³²¾Ò
- // À» ¶§ ¿©±â¿¡ dwTimeRemainÀ¸·Î ³Ö¾î¼ Á¦´ë·Î °è»êµÇµµ·Ï ÇØÁÖ¾î¾ß ÇÑ´Ù.
- void CHARACTER::ResetPlayTime(DWORD dwTimeRemain)
- {
- m_dwPlayStartTime = get_dword_time() - dwTimeRemain;
- }
- const int aiRecoveryPercents[10] = { 1, 5, 5, 5, 5, 5, 5, 5, 5, 5 };
- EVENTFUNC(recovery_event)
- {
- char_event_info* info = dynamic_cast<char_event_info*>( event->info );
- if ( info == NULL )
- {
- sys_err( "recovery_event> <Factor> Null pointer" );
- return 0;
- }
- LPCHARACTER ch = info->ch;
- if (ch == NULL) { // <Factor>
- return 0;
- }
- if (!ch->IsPC())
- {
- //
- // ¸ó½ºÅÍ È¸º¹
- //
- if (ch->IsAffectFlag(AFF_POISON))
- return PASSES_PER_SEC(MAX(1, ch->GetMobTable().bRegenCycle));
- if (2493 == ch->GetMobTable().dwVnum)
- {
- int regenPct = BlueDragon_GetRangeFactor("hp_regen", ch->GetHPPct());
- regenPct += ch->GetMobTable().bRegenPercent;
- for (int i=1 ; i <= 4 ; ++i)
- {
- if (REGEN_PECT_BONUS == BlueDragon_GetIndexFactor("DragonStone", i, "effect_type"))
- {
- DWORD dwDragonStoneID = BlueDragon_GetIndexFactor("DragonStone", i, "vnum");
- size_t val = BlueDragon_GetIndexFactor("DragonStone", i, "val");
- size_t cnt = SECTREE_MANAGER::instance().GetMonsterCountInMap( ch->GetMapIndex(), dwDragonStoneID );
- regenPct += (val*cnt);
- break;
- }
- }
- ch->PointChange(POINT_HP, MAX(1, (ch->GetMaxHP() * regenPct) / 100));
- }
- else if (!ch->IsDoor())
- {
- ch->MonsterLog("HP_REGEN +%d", MAX(1, (ch->GetMaxHP() * ch->GetMobTable().bRegenPercent) / 100));
- ch->PointChange(POINT_HP, MAX(1, (ch->GetMaxHP() * ch->GetMobTable().bRegenPercent) / 100));
- }
- if (ch->GetHP() >= ch->GetMaxHP())
- {
- ch->m_pkRecoveryEvent = NULL;
- return 0;
- }
- if (2493 == ch->GetMobTable().dwVnum)
- {
- for (int i=1 ; i <= 4 ; ++i)
- {
- if (REGEN_TIME_BONUS == BlueDragon_GetIndexFactor("DragonStone", i, "effect_type"))
- {
- DWORD dwDragonStoneID = BlueDragon_GetIndexFactor("DragonStone", i, "vnum");
- size_t val = BlueDragon_GetIndexFactor("DragonStone", i, "val");
- size_t cnt = SECTREE_MANAGER::instance().GetMonsterCountInMap( ch->GetMapIndex(), dwDragonStoneID );
- return PASSES_PER_SEC(MAX(1, (ch->GetMobTable().bRegenCycle - (val*cnt))));
- }
- }
- }
- return PASSES_PER_SEC(MAX(1, ch->GetMobTable().bRegenCycle));
- }
- else
- {
- //
- // PC ȸº¹
- //
- ch->CheckTarget();
- //ch->UpdateSectree(); // ¿©±â¼ ÀÌ°É ¿ÖÇÏÁö?
- ch->UpdateKillerMode();
- if (ch->IsAffectFlag(AFF_POISON) == true)
- {
- // Áßµ¶ÀÎ °æ¿ì ÀÚµ¿È¸º¹ ±ÝÁö
- // ÆĹý¼úÀÎ °æ¿ì ÀÚµ¿È¸º¹ ±ÝÁö
- return 3;
- }
- int iSec = (get_dword_time() - ch->GetLastMoveTime()) / 3000;
- // SP ȸº¹ ·çƾ.
- // ¿Ö ÀÌ°É·Î Çؼ ÇÔ¼ö·Î »©³ù´Â°¡ ?!
- ch->DistributeSP(ch);
- if (ch->GetMaxHP() <= ch->GetHP())
- return PASSES_PER_SEC(3);
- int iPercent = 0;
- int iAmount = 0;
- {
- iPercent = aiRecoveryPercents[MIN(9, iSec)];
- iAmount = 15 + (ch->GetMaxHP() * iPercent) / 100;
- }
- iAmount += (iAmount * ch->GetPoint(POINT_HP_REGEN)) / 100;
- sys_log(1, "RECOVERY_EVENT: %s %d HP_REGEN %d HP +%d", ch->GetName(), iPercent, ch->GetPoint(POINT_HP_REGEN), iAmount);
- ch->PointChange(POINT_HP, iAmount, false);
- return PASSES_PER_SEC(3);
- }
- }
- void CHARACTER::StartRecoveryEvent()
- {
- if (m_pkRecoveryEvent)
- return;
- if (IsDead() || IsStun())
- return;
- if (IsNPC() && GetHP() >= GetMaxHP()) // ¸ó½ºÅʹ ü·ÂÀÌ ´Ù Â÷ÀÖÀ¸¸é ½ÃÀÛ ¾ÈÇÑ´Ù.
- return;
- char_event_info* info = AllocEventInfo<char_event_info>();
- info->ch = this;
- int iSec = IsPC() ? 3 : (MAX(1, GetMobTable().bRegenCycle));
- m_pkRecoveryEvent = event_create(recovery_event, info, PASSES_PER_SEC(iSec));
- }
- void CHARACTER::Standup()
- {
- struct packet_position pack_position;
- if (!IsPosition(POS_SITTING))
- return;
- SetPosition(POS_STANDING);
- sys_log(1, "STANDUP: %s", GetName());
- pack_position.header = HEADER_GC_CHARACTER_POSITION;
- pack_position.vid = GetVID();
- pack_position.position = POSITION_GENERAL;
- PacketAround(&pack_position, sizeof(pack_position));
- }
- void CHARACTER::Sitdown(int is_ground)
- {
- struct packet_position pack_position;
- if (IsPosition(POS_SITTING))
- return;
- SetPosition(POS_SITTING);
- sys_log(1, "SITDOWN: %s", GetName());
- pack_position.header = HEADER_GC_CHARACTER_POSITION;
- pack_position.vid = GetVID();
- pack_position.position = POSITION_SITTING_GROUND;
- PacketAround(&pack_position, sizeof(pack_position));
- }
- void CHARACTER::SetRotation(float fRot)
- {
- m_pointsInstant.fRot = fRot;
- }
- // x, y ¹æÇâÀ¸·Î º¸°í ¼±´Ù.
- void CHARACTER::SetRotationToXY(long x, long y)
- {
- SetRotation(GetDegreeFromPositionXY(GetX(), GetY(), x, y));
- }
- bool CHARACTER::CannotMoveByAffect() const
- {
- return (IsAffectFlag(AFF_STUN));
- }
- bool CHARACTER::CanMove() const
- {
- if (CannotMoveByAffect())
- return false;
- if (GetMyShop()) // »óÁ¡ ¿¬ »óÅ¿¡¼´Â ¿òÁ÷ÀÏ ¼ö ¾øÀ½
- return false;
- // 0.2ÃÊ ÀüÀ̶ó¸é ¿òÁ÷ÀÏ ¼ö ¾ø´Ù.
- /*
- if (get_float_time() - m_fSyncTime < 0.2f)
- return false;
- */
- return true;
- }
- // ¹«Á¶°Ç x, y À§Ä¡·Î À̵¿ ½ÃŲ´Ù.
- bool CHARACTER::Sync(long x, long y)
- {
- if (!GetSectree())
- return false;
- LPSECTREE new_tree = SECTREE_MANAGER::instance().Get(GetMapIndex(), x, y);
- if (!new_tree)
- {
- if (GetDesc())
- {
- sys_err("cannot find tree at %d %d (name: %s)", x, y, GetName());
- GetDesc()->SetPhase(PHASE_CLOSE);
- }
- else
- {
- sys_err("no tree: %s %d %d %d", GetName(), x, y, GetMapIndex());
- Dead();
- }
- return false;
- }
- SetRotationToXY(x, y);
- SetXYZ(x, y, 0);
- if (GetDungeon())
- {
- // ´øÁ¯¿ë À̺¥Æ® ¼Ó¼º º¯È
- int iLastEventAttr = m_iEventAttr;
- m_iEventAttr = new_tree->GetEventAttribute(x, y);
- if (m_iEventAttr != iLastEventAttr)
- {
- if (GetParty())
- {
- quest::CQuestManager::instance().AttrOut(GetParty()->GetLeaderPID(), this, iLastEventAttr);
- quest::CQuestManager::instance().AttrIn(GetParty()->GetLeaderPID(), this, m_iEventAttr);
- }
- else
- {
- quest::CQuestManager::instance().AttrOut(GetPlayerID(), this, iLastEventAttr);
- quest::CQuestManager::instance().AttrIn(GetPlayerID(), this, m_iEventAttr);
- }
- }
- }
- if (GetSectree() != new_tree)
- {
- if (!IsNPC())
- {
- SECTREEID id = new_tree->GetID();
- SECTREEID old_id = GetSectree()->GetID();
- sys_log(0, "SECTREE DIFFER: %s %dx%d was %dx%d",
- GetName(),
- id.coord.x,
- id.coord.y,
- old_id.coord.x,
- old_id.coord.y);
- }
- new_tree->InsertEntity(this);
- }
- return true;
- }
- void CHARACTER::Stop()
- {
- if (!IsState(m_stateIdle))
- MonsterLog("[IDLE] Á¤Áö");
- GotoState(m_stateIdle);
- m_posDest.x = m_posStart.x = GetX();
- m_posDest.y = m_posStart.y = GetY();
- }
- bool CHARACTER::Goto(long x, long y)
- {
- // TODO °Å¸®Ã¼Å© ÇÊ¿ä
- // °°Àº À§Ä¡¸é À̵¿ÇÒ ÇÊ¿ä ¾øÀ½ (ÀÚµ¿ ¼º°ø)
- if (GetX() == x && GetY() == y)
- return false;
- if (m_posDest.x == x && m_posDest.y == y)
- {
- if (!IsState(m_stateMove))
- {
- m_dwStateDuration = 4;
- GotoState(m_stateMove);
- }
- return false;
- }
- m_posDest.x = x;
- m_posDest.y = y;
- CalculateMoveDuration();
- m_dwStateDuration = 4;
- if (!IsState(m_stateMove))
- {
- MonsterLog("[MOVE] %s", GetVictim() ? "´ë»óÃßÀû" : "±×³ÉÀ̵¿");
- if (GetVictim())
- {
- //MonsterChat(MONSTER_CHAT_CHASE);
- MonsterChat(MONSTER_CHAT_ATTACK);
- }
- }
- GotoState(m_stateMove);
- return true;
- }
- DWORD CHARACTER::GetMotionMode() const
- {
- DWORD dwMode = MOTION_MODE_GENERAL;
- if (IsPolymorphed())
- return dwMode;
- LPITEM pkItem;
- if ((pkItem = GetWear(WEAR_WEAPON)))
- {
- switch (pkItem->GetProto()->bSubType)
- {
- case WEAPON_SWORD:
- dwMode = MOTION_MODE_ONEHAND_SWORD;
- break;
- case WEAPON_TWO_HANDED:
- dwMode = MOTION_MODE_TWOHAND_SWORD;
- break;
- case WEAPON_DAGGER:
- dwMode = MOTION_MODE_DUALHAND_SWORD;
- break;
- case WEAPON_BOW:
- dwMode = MOTION_MODE_BOW;
- break;
- case WEAPON_BELL:
- dwMode = MOTION_MODE_BELL;
- break;
- case WEAPON_FAN:
- dwMode = MOTION_MODE_FAN;
- break;
- }
- }
- return dwMode;
- }
- float CHARACTER::GetMoveMotionSpeed() const
- {
- DWORD dwMode = GetMotionMode();
- const CMotion * pkMotion = NULL;
- if (!GetMountVnum())
- pkMotion = CMotionManager::instance().GetMotion(GetRaceNum(), MAKE_MOTION_KEY(dwMode, (IsWalking() && IsPC()) ? MOTION_WALK : MOTION_RUN));
- else
- {
- pkMotion = CMotionManager::instance().GetMotion(GetMountVnum(), MAKE_MOTION_KEY(MOTION_MODE_GENERAL, (IsWalking() && IsPC()) ? MOTION_WALK : MOTION_RUN));
- if (!pkMotion)
- pkMotion = CMotionManager::instance().GetMotion(GetRaceNum(), MAKE_MOTION_KEY(MOTION_MODE_HORSE, (IsWalking() && IsPC()) ? MOTION_WALK : MOTION_RUN));
- }
- if (pkMotion)
- return -pkMotion->GetAccumVector().y / pkMotion->GetDuration();
- else
- {
- sys_err("cannot find motion (name %s race %d mode %d)", GetName(), GetRaceNum(), dwMode);
- return 300.0f;
- }
- }
- float CHARACTER::GetMoveSpeed() const
- {
- return GetMoveMotionSpeed() * 10000 / CalculateDuration(GetLimitPoint(POINT_MOV_SPEED), 10000);
- }
- void CHARACTER::CalculateMoveDuration()
- {
- m_posStart.x = GetX();
- m_posStart.y = GetY();
- float fDist = DISTANCE_SQRT(m_posStart.x - m_posDest.x, m_posStart.y - m_posDest.y);
- float motionSpeed = GetMoveMotionSpeed();
- m_dwMoveDuration = CalculateDuration(GetLimitPoint(POINT_MOV_SPEED),
- (int) ((fDist / motionSpeed) * 1000.0f));
- if (IsNPC())
- sys_log(1, "%s: GOTO: distance %f, spd %u, duration %u, motion speed %f pos %d %d -> %d %d",
- GetName(), fDist, GetLimitPoint(POINT_MOV_SPEED), m_dwMoveDuration, motionSpeed,
- m_posStart.x, m_posStart.y, m_posDest.x, m_posDest.y);
- m_dwMoveStartTime = get_dword_time();
- }
- // x y À§Ä¡·Î À̵¿ ÇÑ´Ù. (À̵¿ÇÒ ¼ö ÀÖ´Â °¡ ¾ø´Â °¡¸¦ È®ÀÎ ÇÏ°í Sync ¸Þ¼Òµå·Î ½ÇÁ¦ À̵¿ ÇÑ´Ù)
- // ¼¹ö´Â charÀÇ x, y °ªÀ» ¹Ù·Î ¹Ù²ÙÁö¸¸,
- // Ŭ¶ó¿¡¼´Â ÀÌÀü À§Ä¡¿¡¼ ¹Ù²Û x, y±îÁö interpolationÇÑ´Ù.
- // °È°Å³ª ¶Ù´Â °ÍÀº charÀÇ m_bNowWalking¿¡ ´Þ·ÁÀÖ´Ù.
- // Warp¸¦ ÀǵµÇÑ °ÍÀ̶ó¸é Show¸¦ »ç¿ëÇÒ °Í.
- bool CHARACTER::Move(long x, long y)
- {
- // °°Àº À§Ä¡¸é À̵¿ÇÒ ÇÊ¿ä ¾øÀ½ (ÀÚµ¿ ¼º°ø)
- if (GetX() == x && GetY() == y)
- return true;
- if (test_server)
- if (m_bDetailLog)
- sys_log(0, "%s position %u %u", GetName(), x, y);
- OnMove();
- return Sync(x, y);
- }
- void CHARACTER::SendMovePacket(BYTE bFunc, BYTE bArg, DWORD x, DWORD y, DWORD dwDuration, DWORD dwTime, int iRot)
- {
- TPacketGCMove pack;
- if (bFunc == FUNC_WAIT)
- {
- x = m_posDest.x;
- y = m_posDest.y;
- dwDuration = m_dwMoveDuration;
- }
- EncodeMovePacket(pack, GetVID(), bFunc, bArg, x, y, dwDuration, dwTime, iRot == -1 ? (int) GetRotation() / 5 : iRot);
- PacketView(&pack, sizeof(TPacketGCMove), this);
- }
- int CHARACTER::GetRealPoint(BYTE type) const
- {
- return m_points.points[type];
- }
- void CHARACTER::SetRealPoint(BYTE type, int val)
- {
- m_points.points[type] = val;
- }
- int CHARACTER::GetPolymorphPoint(BYTE type) const
- {
- if (IsPolymorphed() && !IsPolyMaintainStat())
- {
- DWORD dwMobVnum = GetPolymorphVnum();
- const CMob * pMob = CMobManager::instance().Get(dwMobVnum);
- int iPower = GetPolymorphPower();
- if (pMob)
- {
- switch (type)
- {
- case POINT_ST:
- if (GetJob() == JOB_SHAMAN || GetJob() == JOB_SURA && GetSkillGroup() == 2)
- return pMob->m_table.bStr * iPower / 100 + GetPoint(POINT_IQ);
- return pMob->m_table.bStr * iPower / 100 + GetPoint(POINT_ST);
- case POINT_HT:
- return pMob->m_table.bCon * iPower / 100 + GetPoint(POINT_HT);
- case POINT_IQ:
- return pMob->m_table.bInt * iPower / 100 + GetPoint(POINT_IQ);
- case POINT_DX:
- return pMob->m_table.bDex * iPower / 100 + GetPoint(POINT_DX);
- }
- }
- }
- return GetPoint(type);
- }
- int CHARACTER::GetPoint(BYTE type) const
- {
- if (type >= POINT_MAX_NUM)
- {
- sys_err("Point type overflow (type %u)", type);
- return 0;
- }
- int val = m_pointsInstant.points[type];
- int max_val = INT_MAX;
- switch (type)
- {
- case POINT_STEAL_HP:
- case POINT_STEAL_SP:
- max_val = 50;
- break;
- }
- if (val > max_val)
- sys_err("POINT_ERROR: %s type %d val %d (max: %d)", GetName(), val, max_val);
- return (val);
- }
- int CHARACTER::GetLimitPoint(BYTE type) const
- {
- if (type >= POINT_MAX_NUM)
- {
- sys_err("Point type overflow (type %u)", type);
- return 0;
- }
- int val = m_pointsInstant.points[type];
- int max_val = INT_MAX;
- int limit = INT_MAX;
- int min_limit = -INT_MAX;
- switch (type)
- {
- case POINT_ATT_SPEED:
- min_limit = 0;
- if (IsPC())
- limit = 170;
- else
- limit = 250;
- break;
- case POINT_MOV_SPEED:
- min_limit = 0;
- if (IsPC())
- limit = 200;
- else
- limit = 250;
- break;
- case POINT_STEAL_HP:
- case POINT_STEAL_SP:
- limit = 50;
- max_val = 50;
- break;
- case POINT_MALL_ATTBONUS:
- case POINT_MALL_DEFBONUS:
- limit = 20;
- max_val = 50;
- break;
- }
- if (val > max_val)
- sys_err("POINT_ERROR: %s type %d val %d (max: %d)", GetName(), val, max_val);
- if (val > limit)
- val = limit;
- if (val < min_limit)
- val = min_limit;
- return (val);
- }
- void CHARACTER::SetPoint(BYTE type, int val)
- {
- if (type >= POINT_MAX_NUM)
- {
- sys_err("Point type overflow (type %u)", type);
- return;
- }
- m_pointsInstant.points[type] = val;
- // ¾ÆÁ÷ À̵¿ÀÌ ´Ù ¾È³¡³µ´Ù¸é À̵¿ ½Ã°£ °è»êÀ» ´Ù½Ã ÇØ¾ß ÇÑ´Ù.
- if (type == POINT_MOV_SPEED && get_dword_time() < m_dwMoveStartTime + m_dwMoveDuration)
- {
- CalculateMoveDuration();
- }
- }
- INT CHARACTER::GetAllowedGold() const
- {
- if (GetLevel() <= 10)
- return 100000;
- else if (GetLevel() <= 20)
- return 500000;
- else
- return 50000000;
- }
- void CHARACTER::CheckMaximumPoints()
- {
- if (GetMaxHP() < GetHP())
- PointChange(POINT_HP, GetMaxHP() - GetHP());
- if (GetMaxSP() < GetSP())
- PointChange(POINT_SP, GetMaxSP() - GetSP());
- }
- void CHARACTER::PointChange(BYTE type, int amount, bool bAmount, bool bBroadcast)
- {
- int val = 0;
- //sys_log(0, "PointChange %d %d | %d -> %d cHP %d mHP %d", type, amount, GetPoint(type), GetPoint(type)+amount, GetHP(), GetMaxHP());
- switch (type)
- {
- case POINT_NONE:
- return;
- case POINT_LEVEL:
- if ((GetLevel() + amount) > gPlayerMaxLevel)
- return;
- SetLevel(GetLevel() + amount);
- val = GetLevel();
- sys_log(0, "LEVELUP: %s %d NEXT EXP %d", GetName(), GetLevel(), GetNextExp());
- PointChange(POINT_NEXT_EXP, GetNextExp(), false);
- if (amount)
- {
- quest::CQuestManager::instance().LevelUp(GetPlayerID());
- LogManager::instance().LevelLog(this, val, GetRealPoint(POINT_PLAYTIME) + (get_dword_time() - m_dwPlayStartTime) / 60000);
- if (GetGuild())
- {
- GetGuild()->LevelChange(GetPlayerID(), GetLevel());
- }
- if (GetParty())
- {
- GetParty()->RequestSetMemberLevel(GetPlayerID(), GetLevel());
- }
- }
- break;
- case POINT_NEXT_EXP:
- val = GetNextExp();
- bAmount = false; // ¹«Á¶°Ç bAmount´Â false ¿©¾ß ÇÑ´Ù.
- break;
- case POINT_EXP:
- {
- DWORD exp = GetExp();
- DWORD next_exp = GetNextExp();
- // û¼Ò³âº¸È£
- if (LC_IsNewCIBN())
- {
- if (IsOverTime(OT_NONE))
- {
- dev_log(LOG_DEB0, "<EXP_LOG> %s = NONE", GetName());
- }
- else if (IsOverTime(OT_3HOUR))
- {
- amount = (amount / 2);
- dev_log(LOG_DEB0, "<EXP_LOG> %s = 3HOUR", GetName());
- }
- else if (IsOverTime(OT_5HOUR))
- {
- amount = 0;
- dev_log(LOG_DEB0, "<EXP_LOG> %s = 5HOUR", GetName());
- }
- }
- // exp°¡ 0 ÀÌÇÏ·Î °¡Áö ¾Êµµ·Ï ÇÑ´Ù
- if (amount < 0 && exp < -amount)
- {
- sys_log(1, "%s AMOUNT < 0 %d, CUR EXP: %d", GetName(), -amount, exp);
- amount = -exp;
- SetExp(exp + amount);
- val = GetExp();
- }
- else
- {
- if (gPlayerMaxLevel <= GetLevel())
- return;
- if (block_exp)
- {
- return;
- }
- if (test_server)
- ChatPacket(CHAT_TYPE_INFO, "You have gained %d exp.", amount);
- DWORD iExpBalance = 0;
- // ·¹º§ ¾÷!
- if (exp + amount >= next_exp)
- {
- iExpBalance = (exp + amount) - next_exp;
- amount = next_exp - exp;
- SetExp(0);
- exp = next_exp;
- }
- else
- {
- SetExp(exp + amount);
- exp = GetExp();
- }
- DWORD q = DWORD(next_exp / 4.0f);
- int iLevStep = GetRealPoint(POINT_LEVEL_STEP);
- // iLevStepÀÌ 4 ÀÌ»óÀÌ¸é ·¹º§ÀÌ ¿Ã¶ú¾î¾ß ÇϹǷΠ¿©±â¿¡ ¿Ã ¼ö ¾ø´Â °ªÀÌ´Ù.
- if (iLevStep >= 4)
- {
- sys_err("%s LEVEL_STEP bigger than 4! (%d)", GetName(), iLevStep);
- iLevStep = 4;
- }
- if (exp >= next_exp && iLevStep < 4)
- {
- for (int i = 0; i < 4 - iLevStep; ++i)
- PointChange(POINT_LEVEL_STEP, 1, false, true);
- }
- else if (exp >= q * 3 && iLevStep < 3)
- {
- for (int i = 0; i < 3 - iLevStep; ++i)
- PointChange(POINT_LEVEL_STEP, 1, false, true);
- }
- else if (exp >= q * 2 && iLevStep < 2)
- {
- for (int i = 0; i < 2 - iLevStep; ++i)
- PointChange(POINT_LEVEL_STEP, 1, false, true);
- }
- else if (exp >= q && iLevStep < 1)
- PointChange(POINT_LEVEL_STEP, 1);
- if (iExpBalance)
- {
- PointChange(POINT_EXP, iExpBalance);
- }
- val = GetExp();
- }
- }
- break;
- case POINT_LEVEL_STEP:
- if (amount > 0)
- {
- val = GetPoint(POINT_LEVEL_STEP) + amount;
- switch (val)
- {
- case 1:
- case 2:
- case 3:
- //if (GetLevel() < 100) PointChange(POINT_STAT, 1);
- if (GetLevel() < 91) PointChange(POINT_STAT, 1);
- break;
- case 4:
- {
- int iHP = number(JobInitialPoints[GetJob()].hp_per_lv_begin, JobInitialPoints[GetJob()].hp_per_lv_end);
- int iSP = number(JobInitialPoints[GetJob()].sp_per_lv_begin, JobInitialPoints[GetJob()].sp_per_lv_end);
- m_points.iRandomHP += iHP;
- m_points.iRandomSP += iSP;
- if (GetSkillGroup())
- {
- if (GetLevel() >= 5)
- PointChange(POINT_SKILL, 1);
- if (GetLevel() >= 9)
- PointChange(POINT_SUB_SKILL, 1);
- }
- PointChange(POINT_MAX_HP, iHP);
- PointChange(POINT_MAX_SP, iSP);
- PointChange(POINT_LEVEL, 1, false, true);
- val = 0;
- }
- break;
- }
- if (GetLevel() <= 10)
- AutoGiveItem(27001, 2);
- else if (GetLevel() <= 30)
- AutoGiveItem(27002, 2);
- else
- {
- AutoGiveItem(27002, 2);
- // AutoGiveItem(27003, 2);
- }
- PointChange(POINT_HP, GetMaxHP() - GetHP());
- PointChange(POINT_SP, GetMaxSP() - GetSP());
- PointChange(POINT_STAMINA, GetMaxStamina() - GetStamina());
- SetPoint(POINT_LEVEL_STEP, val);
- SetRealPoint(POINT_LEVEL_STEP, val);
- Save();
- }
- else
- val = GetPoint(POINT_LEVEL_STEP);
- break;
- case POINT_HP:
- {
- if (IsDead() || IsStun())
- return;
- int prev_hp = GetHP();
- amount = MIN(GetMaxHP() - GetHP(), amount);
- SetHP(GetHP() + amount);
- val = GetHP();
- BroadcastTargetPacket();
- if (GetParty() && IsPC() && val != prev_hp)
- GetParty()->SendPartyInfoOneToAll(this);
- }
- break;
- case POINT_SP:
- {
- if (IsDead() || IsStun())
- return;
- amount = MIN(GetMaxSP() - GetSP(), amount);
- SetSP(GetSP() + amount);
- val = GetSP();
- }
- break;
- case POINT_STAMINA:
- {
- if (IsDead() || IsStun())
- return;
- int prev_val = GetStamina();
- amount = MIN(GetMaxStamina() - GetStamina(), amount);
- SetStamina(GetStamina() + amount);
- val = GetStamina();
- if (val == 0)
- {
- // Stamina°¡ ¾øÀ¸´Ï °ÈÀÚ!
- SetNowWalking(true);
- }
- else if (prev_val == 0)
- {
- // ¾ø´ø ½ºÅ׹̳ª°¡ »ý°åÀ¸´Ï ÀÌÀü ¸ðµå º¹±Í
- ResetWalking();
- }
- if (amount < 0 && val != 0) // °¨¼Ò´Â º¸³»Áö¾Ê´Â´Ù.
- return;
- }
- break;
- case POINT_MAX_HP:
- {
- SetPoint(type, GetPoint(type) + amount);
- //SetMaxHP(GetMaxHP() + amount);
- // ÃÖ´ë »ý¸í·Â = (±âº» ÃÖ´ë »ý¸í·Â + Ãß°¡) * ÃÖ´ë»ý¸í·Â%
- int hp = GetRealPoint(POINT_MAX_HP);
- int add_hp = MIN(3500, hp * GetPoint(POINT_MAX_HP_PCT) / 100);
- add_hp += GetPoint(POINT_MAX_HP);
- add_hp += GetPoint(POINT_PARTY_TANKER_BONUS);
- SetMaxHP(hp + add_hp);
- val = GetMaxHP();
- }
- break;
- case POINT_MAX_SP:
- {
- SetPoint(type, GetPoint(type) + amount);
- //SetMaxSP(GetMaxSP() + amount);
- // ÃÖ´ë Á¤½Å·Â = (±âº» ÃÖ´ë Á¤½Å·Â + Ãß°¡) * ÃÖ´ëÁ¤½Å·Â%
- int sp = GetRealPoint(POINT_MAX_SP);
- int add_sp = MIN(800, sp * GetPoint(POINT_MAX_SP_PCT) / 100);
- add_sp += GetPoint(POINT_MAX_SP);
- add_sp += GetPoint(POINT_PARTY_SKILL_MASTER_BONUS);
- SetMaxSP(sp + add_sp);
- val = GetMaxSP();
- }
- break;
- case POINT_MAX_HP_PCT:
- SetPoint(type, GetPoint(type) + amount);
- val = GetPoint(type);
- PointChange(POINT_MAX_HP, 0);
- break;
- case POINT_MAX_SP_PCT:
- SetPoint(type, GetPoint(type) + amount);
- val = GetPoint(type);
- PointChange(POINT_MAX_SP, 0);
- break;
- case POINT_MAX_STAMINA:
- SetMaxStamina(GetMaxStamina() + amount);
- val = GetMaxStamina();
- break;
- case POINT_GOLD:
- {
- const int64_t nTotalMoney = static_cast<int64_t>(GetGold()) + static_cast<int64_t>(amount);
- if (GOLD_MAX <= nTotalMoney)
- {
- sys_err("[OVERFLOW_GOLD] OriGold %d AddedGold %d id %u Name %s ", GetGold(), amount, GetPlayerID(), GetName());
- LogManager::instance().CharLog(this, GetGold() + amount, "OVERFLOW_GOLD", "");
- return;
- }
- // û¼Ò³âº¸È£
- if (LC_IsNewCIBN() && amount > 0)
- {
- if (IsOverTime(OT_NONE))
- {
- dev_log(LOG_DEB0, "<GOLD_LOG> %s = NONE", GetName());
- }
- else if (IsOverTime(OT_3HOUR))
- {
- amount = (amount / 2);
- dev_log(LOG_DEB0, "<GOLD_LOG> %s = 3HOUR", GetName());
- }
- else if (IsOverTime(OT_5HOUR))
- {
- amount = 0;
- dev_log(LOG_DEB0, "<GOLD_LOG> %s = 5HOUR", GetName());
- }
- }
- SetGold(GetGold() + amount);
- val = GetGold();
- }
- break;
- case POINT_SKILL:
- case POINT_STAT:
- case POINT_SUB_SKILL:
- case POINT_STAT_RESET_COUNT:
- case POINT_HORSE_SKILL:
- SetPoint(type, GetPoint(type) + amount);
- val = GetPoint(type);
- SetRealPoint(type, val);
- break;
- case POINT_DEF_GRADE:
- SetPoint(type, GetPoint(type) + amount);
- val = GetPoint(type);
- PointChange(POINT_CLIENT_DEF_GRADE, amount);
- break;
- case POINT_CLIENT_DEF_GRADE:
- SetPoint(type, GetPoint(type) + amount);
- val = GetPoint(type);
- break;
- case POINT_ST:
- case POINT_HT:
- case POINT_DX:
- case POINT_IQ:
- case POINT_HP_REGEN:
- case POINT_SP_REGEN:
- case POINT_ATT_SPEED:
- case POINT_ATT_GRADE:
- case POINT_MOV_SPEED:
- case POINT_CASTING_SPEED:
- case POINT_MAGIC_ATT_GRADE:
- case POINT_MAGIC_DEF_GRADE:
- case POINT_BOW_DISTANCE:
- case POINT_HP_RECOVERY:
- case POINT_SP_RECOVERY:
- case POINT_ATTBONUS_HUMAN: // 42 Àΰ£¿¡°Ô °ÇÔ
- case POINT_ATTBONUS_ANIMAL: // 43 µ¿¹°¿¡°Ô µ¥¹ÌÁö % Áõ°¡
- case POINT_ATTBONUS_ORC: // 44 ¿õ±Í¿¡°Ô µ¥¹ÌÁö % Áõ°¡
- case POINT_ATTBONUS_MILGYO: // 45 ¹Ð±³¿¡°Ô µ¥¹ÌÁö % Áõ°¡
- case POINT_ATTBONUS_UNDEAD: // 46 ½Ãü¿¡°Ô µ¥¹ÌÁö % Áõ°¡
- case POINT_ATTBONUS_DEVIL: // 47 ¸¶±Í(¾Ç¸¶)¿¡°Ô µ¥¹ÌÁö % Áõ°¡
- case POINT_ATTBONUS_MONSTER:
- case POINT_ATTBONUS_SURA:
- case POINT_ATTBONUS_ASSASSIN:
- case POINT_ATTBONUS_WARRIOR:
- case POINT_ATTBONUS_SHAMAN:
- case POINT_POISON_PCT:
- case POINT_STUN_PCT:
- case POINT_SLOW_PCT:
- case POINT_BLOCK:
- case POINT_DODGE:
- case POINT_CRITICAL_PCT:
- case POINT_RESIST_CRITICAL:
- case POINT_PENETRATE_PCT:
- case POINT_RESIST_PENETRATE:
- case POINT_CURSE_PCT:
- case POINT_STEAL_HP: // 48 »ý¸í·Â Èí¼ö
- case POINT_STEAL_SP: // 49 Á¤½Å·Â Èí¼ö
- case POINT_MANA_BURN_PCT: // 50 ¸¶³ª ¹ø
- case POINT_DAMAGE_SP_RECOVER: // 51 °ø°Ý´çÇÒ ½Ã Á¤½Å·Â ȸº¹ È®·ü
- case POINT_RESIST_NORMAL_DAMAGE:
- case POINT_RESIST_SWORD:
- case POINT_RESIST_TWOHAND:
- case POINT_RESIST_DAGGER:
- case POINT_RESIST_BELL:
- case POINT_RESIST_FAN:
- case POINT_RESIST_BOW:
- case POINT_RESIST_FIRE:
- case POINT_RESIST_ELEC:
- case POINT_RESIST_MAGIC:
- case POINT_RESIST_WIND:
- case POINT_RESIST_ICE:
- case POINT_RESIST_EARTH:
- case POINT_RESIST_DARK:
- case POINT_REFLECT_MELEE: // 67 °ø°Ý ¹Ý»ç
- case POINT_REFLECT_CURSE: // 68 ÀúÁÖ ¹Ý»ç
- case POINT_POISON_REDUCE: // 69 µ¶µ¥¹ÌÁö °¨¼Ò
- case POINT_KILL_SP_RECOVER: // 70 Àû ¼Ò¸ê½Ã MP ȸº¹
- case POINT_KILL_HP_RECOVERY: // 75
- case POINT_HIT_HP_RECOVERY:
- case POINT_HIT_SP_RECOVERY:
- case POINT_MANASHIELD:
- case POINT_ATT_BONUS:
- case POINT_DEF_BONUS:
- case POINT_SKILL_DAMAGE_BONUS:
- case POINT_NORMAL_HIT_DAMAGE_BONUS:
- // DEPEND_BONUS_ATTRIBUTES
- case POINT_SKILL_DEFEND_BONUS:
- case POINT_NORMAL_HIT_DEFEND_BONUS:
- SetPoint(type, GetPoint(type) + amount);
- val = GetPoint(type);
- break;
- // END_OF_DEPEND_BONUS_ATTRIBUTES
- case POINT_PARTY_ATTACKER_BONUS:
- case POINT_PARTY_TANKER_BONUS:
- case POINT_PARTY_BUFFER_BONUS:
- case POINT_PARTY_SKILL_MASTER_BONUS:
- case POINT_PARTY_HASTE_BONUS:
- case POINT_PARTY_DEFENDER_BONUS:
- case POINT_RESIST_WARRIOR :
- case POINT_RESIST_ASSASSIN :
- case POINT_RESIST_SURA :
- case POINT_RESIST_SHAMAN :
- SetPoint(type, GetPoint(type) + amount);
- val = GetPoint(type);
- break;
- case POINT_MALL_ATTBONUS:
- case POINT_MALL_DEFBONUS:
- case POINT_MALL_EXPBONUS:
- case POINT_MALL_ITEMBONUS:
- case POINT_MALL_GOLDBONUS:
- case POINT_MELEE_MAGIC_ATT_BONUS_PER:
- if (GetPoint(type) + amount > 100)
- {
- sys_err("MALL_BONUS exceeded over 100!! point type: %d name: %s amount %d", type, GetName(), amount);
- amount = 100 - GetPoint(type);
- }
- SetPoint(type, GetPoint(type) + amount);
- val = GetPoint(type);
- break;
- // PC_BANG_ITEM_ADD
- case POINT_PC_BANG_EXP_BONUS :
- case POINT_PC_BANG_DROP_BONUS :
- case POINT_RAMADAN_CANDY_BONUS_EXP:
- SetPoint(type, amount);
- val = GetPoint(type);
- break;
- // END_PC_BANG_ITEM_ADD
- case POINT_EXP_DOUBLE_BONUS: // 71
- case POINT_GOLD_DOUBLE_BONUS: // 72
- case POINT_ITEM_DROP_BONUS: // 73
- case POINT_POTION_BONUS: // 74
- if (GetPoint(type) + amount > 100)
- {
- sys_err("BONUS exceeded over 100!! point type: %d name: %s amount %d", type, GetName(), amount);
- amount = 100 - GetPoint(type);
- }
- SetPoint(type, GetPoint(type) + amount);
- val = GetPoint(type);
- break;
- case POINT_IMMUNE_STUN: // 76
- SetPoint(type, GetPoint(type) + amount);
- val = GetPoint(type);
- if (val)
- {
- SET_BIT(m_pointsInstant.dwImmuneFlag, IMMUNE_STUN);
- }
- else
- {
- REMOVE_BIT(m_pointsInstant.dwImmuneFlag, IMMUNE_STUN);
- }
- break;
- case POINT_IMMUNE_SLOW: // 77
- SetPoint(type, GetPoint(type) + amount);
- val = GetPoint(type);
- if (val)
- {
- SET_BIT(m_pointsInstant.dwImmuneFlag, IMMUNE_SLOW);
- }
- else
- {
- REMOVE_BIT(m_pointsInstant.dwImmuneFlag, IMMUNE_SLOW);
- }
- break;
- case POINT_IMMUNE_FALL: // 78
- SetPoint(type, GetPoint(type) + amount);
- val = GetPoint(type);
- if (val)
- {
- SET_BIT(m_pointsInstant.dwImmuneFlag, IMMUNE_FALL);
- }
- else
- {
- REMOVE_BIT(m_pointsInstant.dwImmuneFlag, IMMUNE_FALL);
- }
- break;
- case POINT_ATT_GRADE_BONUS:
- SetPoint(type, GetPoint(type) + amount);
- PointChange(POINT_ATT_GRADE, amount);
- val = GetPoint(type);
- break;
- case POINT_DEF_GRADE_BONUS:
- SetPoint(type, GetPoint(type) + amount);
- PointChange(POINT_DEF_GRADE, amount);
- val = GetPoint(type);
- break;
- case POINT_MAGIC_ATT_GRADE_BONUS:
- SetPoint(type, GetPoint(type) + amount);
- PointChange(POINT_MAGIC_ATT_GRADE, amount);
- val = GetPoint(type);
- break;
- case POINT_MAGIC_DEF_GRADE_BONUS:
- SetPoint(type, GetPoint(type) + amount);
- PointChange(POINT_MAGIC_DEF_GRADE, amount);
- val = GetPoint(type);
- break;
- case POINT_VOICE:
- case POINT_EMPIRE_POINT:
- //sys_err("CHARACTER::PointChange: %s: point cannot be changed. use SetPoint instead (type: %d)", GetName(), type);
- val = GetRealPoint(type);
- break;
- case POINT_POLYMORPH:
- SetPoint(type, GetPoint(type) + amount);
- val = GetPoint(type);
- SetPolymorph(val);
- break;
- case POINT_MOUNT:
- SetPoint(type, GetPoint(type) + amount);
- val = GetPoint(type);
- MountVnum(val);
- break;
- case POINT_ENERGY:
- case POINT_COSTUME_ATTR_BONUS:
- {
- int old_val = GetPoint(type);
- SetPoint(type, old_val + amount);
- val = GetPoint(type);
- BuffOnAttr_ValueChange(type, old_val, val);
- }
- break;
- default:
- sys_err("CHARACTER::PointChange: %s: unknown point change type %d", GetName(), type);
- return;
- }
- switch (type)
- {
- case POINT_LEVEL:
- case POINT_ST:
- case POINT_DX:
- case POINT_IQ:
- case POINT_HT:
- ComputeBattlePoints();
- break;
- case POINT_MAX_HP:
- case POINT_MAX_SP:
- case POINT_MAX_STAMINA:
- break;
- }
- if (type == POINT_HP && amount == 0)
- return;
- if (GetDesc())
- {
- struct packet_point_change pack;
- pack.header = HEADER_GC_CHARACTER_POINT_CHANGE;
- pack.dwVID = m_vid;
- pack.type = type;
- pack.value = val;
- if (bAmount)
- pack.amount = amount;
- else
- pack.amount = 0;
- if (!bBroadcast)
- GetDesc()->Packet(&pack, sizeof(struct packet_point_change));
- else
- PacketAround(&pack, sizeof(pack));
- }
- }
- void CHARACTER::ApplyPoint(BYTE bApplyType, int iVal)
- {
- switch (bApplyType)
- {
- case APPLY_NONE: // 0
- break;;
- case APPLY_CON:
- PointChange(POINT_HT, iVal);
- PointChange(POINT_MAX_HP, (iVal * JobInitialPoints[GetJob()].hp_per_ht));
- PointChange(POINT_MAX_STAMINA, (iVal * JobInitialPoints[GetJob()].stamina_per_con));
- break;
- case APPLY_INT:
- PointChange(POINT_IQ, iVal);
- PointChange(POINT_MAX_SP, (iVal * JobInitialPoints[GetJob()].sp_per_iq));
- break;
- case APPLY_SKILL:
- // SKILL_DAMAGE_BONUS
- {
- // ÃÖ»óÀ§ ºñÆ® ±âÁØÀ¸·Î 8ºñÆ® vnum, 9ºñÆ® add, 15ºñÆ® change
- // 00000000 00000000 00000000 00000000
- // ^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^
- // vnum ^ add change
- BYTE bSkillVnum = (BYTE) (((DWORD)iVal) >> 24);
- int iAdd = iVal & 0x00800000;
- int iChange = iVal & 0x007fffff;
- sys_log(1, "APPLY_SKILL skill %d add? %d change %d", bSkillVnum, iAdd ? 1 : 0, iChange);
- if (0 == iAdd)
- iChange = -iChange;
- boost::unordered_map<BYTE, int>::iterator iter = m_SkillDamageBonus.find(bSkillVnum);
- if (iter == m_SkillDamageBonus.end())
- m_SkillDamageBonus.insert(std::make_pair(bSkillVnum, iChange));
- else
- iter->second += iChange;
- }
- // END_OF_SKILL_DAMAGE_BONUS
- break;
- case APPLY_STR:
- case APPLY_DEX:
- case APPLY_MAX_HP:
- case APPLY_MAX_SP:
- case APPLY_MAX_HP_PCT:
- case APPLY_MAX_SP_PCT:
- case APPLY_ATT_SPEED:
- case APPLY_MOV_SPEED:
- case APPLY_CAST_SPEED:
- case APPLY_HP_REGEN:
- case APPLY_SP_REGEN:
- case APPLY_POISON_PCT:
- case APPLY_STUN_PCT:
- case APPLY_SLOW_PCT:
- case APPLY_CRITICAL_PCT:
- case APPLY_PENETRATE_PCT:
- case APPLY_ATTBONUS_HUMAN:
- case APPLY_ATTBONUS_ANIMAL:
- case APPLY_ATTBONUS_ORC:
- case APPLY_ATTBONUS_MILGYO:
- case APPLY_ATTBONUS_UNDEAD:
- case APPLY_ATTBONUS_DEVIL:
- case APPLY_ATTBONUS_WARRIOR: // 59
- case APPLY_ATTBONUS_ASSASSIN: // 60
- case APPLY_ATTBONUS_SURA: // 61
- case APPLY_ATTBONUS_SHAMAN: // 62
- case APPLY_ATTBONUS_MONSTER: // 63
- case APPLY_STEAL_HP:
- case APPLY_STEAL_SP:
- case APPLY_MANA_BURN_PCT:
- case APPLY_DAMAGE_SP_RECOVER:
- case APPLY_BLOCK:
- case APPLY_DODGE:
- case APPLY_RESIST_SWORD:
- case APPLY_RESIST_TWOHAND:
- case APPLY_RESIST_DAGGER:
- case APPLY_RESIST_BELL:
- case APPLY_RESIST_FAN:
- case APPLY_RESIST_BOW:
- case APPLY_RESIST_FIRE:
- case APPLY_RESIST_ELEC:
- case APPLY_RESIST_MAGIC:
- case APPLY_RESIST_WIND:
- case APPLY_RESIST_ICE:
- case APPLY_RESIST_EARTH:
- case APPLY_RESIST_DARK:
- case APPLY_REFLECT_MELEE:
- case APPLY_REFLECT_CURSE:
- case APPLY_ANTI_CRITICAL_PCT:
- case APPLY_ANTI_PENETRATE_PCT:
- case APPLY_POISON_REDUCE:
- case APPLY_KILL_SP_RECOVER:
- case APPLY_EXP_DOUBLE_BONUS:
- case APPLY_GOLD_DOUBLE_BONUS:
- case APPLY_ITEM_DROP_BONUS:
- case APPLY_POTION_BONUS:
- case APPLY_KILL_HP_RECOVER:
- case APPLY_IMMUNE_STUN:
- case APPLY_IMMUNE_SLOW:
- case APPLY_IMMUNE_FALL:
- case APPLY_BOW_DISTANCE:
- case APPLY_ATT_GRADE_BONUS:
- case APPLY_DEF_GRADE_BONUS:
- case APPLY_MAGIC_ATT_GRADE:
- case APPLY_MAGIC_DEF_GRADE:
- case APPLY_CURSE_PCT:
- case APPLY_MAX_STAMINA:
- case APPLY_MALL_ATTBONUS:
- case APPLY_MALL_DEFBONUS:
- case APPLY_MALL_EXPBONUS:
- case APPLY_MALL_ITEMBONUS:
- case APPLY_MALL_GOLDBONUS:
- case APPLY_SKILL_DAMAGE_BONUS:
- case APPLY_NORMAL_HIT_DAMAGE_BONUS:
- // DEPEND_BONUS_ATTRIBUTES
- case APPLY_SKILL_DEFEND_BONUS:
- case APPLY_NORMAL_HIT_DEFEND_BONUS:
- // END_OF_DEPEND_BONUS_ATTRIBUTES
- case APPLY_PC_BANG_EXP_BONUS :
- case APPLY_PC_BANG_DROP_BONUS :
- case APPLY_RESIST_WARRIOR :
- case APPLY_RESIST_ASSASSIN :
- case APPLY_RESIST_SURA :
- case APPLY_RESIST_SHAMAN :
- case APPLY_ENERGY: // 82 ±â·Â
- case APPLY_DEF_GRADE: // 83 ¹æ¾î·Â. DEF_GRADE_BONUS´Â Ŭ¶ó¿¡¼ µÎ¹è·Î º¸¿©Áö´Â ÀǵµµÈ ¹ö±×(...)°¡ ÀÖ´Ù.
- case APPLY_COSTUME_ATTR_BONUS: // 84 ÄÚ½ºÆ¬ ¾ÆÀÌÅÛ¿¡ ºÙÀº ¼Ó¼ºÄ¡ º¸³Ê½º
- case APPLY_MAGIC_ATTBONUS_PER: // 85 ¸¶¹ý °ø°Ý·Â +x%
- case APPLY_MELEE_MAGIC_ATTBONUS_PER: // 86 ¸¶¹ý + ¹Ð¸® °ø°Ý·Â +x%
- PointChange(aApplyInfo[bApplyType].bPointType, iVal);
- break;
- default:
- sys_err("Unknown apply type %d name %s", bApplyType, GetName());
- break;
- }
- }
- void CHARACTER::MotionPacketEncode(BYTE motion, LPCHARACTER victim, struct packet_motion * packet)
- {
- packet->header = HEADER_GC_MOTION;
- packet->vid = m_vid;
- packet->motion = motion;
- if (victim)
- packet->victim_vid = victim->GetVID();
- else
- packet->victim_vid = 0;
- }
- void CHARACTER::Motion(BYTE motion, LPCHARACTER victim)
- {
- struct packet_motion pack_motion;
- MotionPacketEncode(motion, victim, &pack_motion);
- PacketAround(&pack_motion, sizeof(struct packet_motion));
- }
- EVENTFUNC(save_event)
- {
- char_event_info* info = dynamic_cast<char_event_info*>( event->info );
- if ( info == NULL )
- {
- sys_err( "save_event> <Factor> Null pointer" );
- return 0;
- }
- LPCHARACTER ch = info->ch;
- if (ch == NULL) { // <Factor>
- return 0;
- }
- sys_log(1, "SAVE_EVENT: %s", ch->GetName());
- ch->Save();
- ch->FlushDelayedSaveItem();
- return (save_event_second_cycle);
- }
- void CHARACTER::StartSaveEvent()
- {
- if (m_pkSaveEvent)
- return;
- char_event_info* info = AllocEventInfo<char_event_info>();
- info->ch = this;
- m_pkSaveEvent = event_create(save_event, info, save_event_second_cycle);
- }
- void CHARACTER::MonsterLog(const char* format, ...)
- {
- if (!test_server)
- return;
- if (IsPC())
- return;
- char chatbuf[CHAT_MAX_LEN + 1];
- int len = snprintf(chatbuf, sizeof(chatbuf), "%u)", (DWORD)GetVID());
- if (len < 0 || len >= (int) sizeof(chatbuf))
- len = sizeof(chatbuf) - 1;
- va_list args;
- va_start(args, format);
- int len2 = vsnprintf(chatbuf + len, sizeof(chatbuf) - len, format, args);
- if (len2 < 0 || len2 >= (int) sizeof(chatbuf) - len)
- len += (sizeof(chatbuf) - len) - 1;
- else
- len += len2;
- // \0 ¹®ÀÚ Æ÷ÇÔ
- ++len;
- va_end(args);
- TPacketGCChat pack_chat;
- pack_chat.header = HEADER_GC_CHAT;
- pack_chat.size = sizeof(TPacketGCChat) + len;
- pack_chat.type = CHAT_TYPE_TALKING;
- pack_chat.id = (DWORD)GetVID();
- pack_chat.bEmpire = 0;
- TEMP_BUFFER buf;
- buf.write(&pack_chat, sizeof(TPacketGCChat));
- buf.write(chatbuf, len);
- CHARACTER_MANAGER::instance().PacketMonsterLog(this, buf.read_peek(), buf.size());
- }
- void CHARACTER::ChatPacket(BYTE type, const char * format, ...)
- {
- LPDESC d = GetDesc();
- if (!d || !format)
- return;
- char chatbuf[CHAT_MAX_LEN + 1];
- va_list args;
- va_start(args, format);
- int len = vsnprintf(chatbuf, sizeof(chatbuf), format, args);
- va_end(args);
- struct packet_chat pack_chat;
- pack_chat.header = HEADER_GC_CHAT;
- pack_chat.size = sizeof(struct packet_chat) + len;
- pack_chat.type = type;
- pack_chat.id = 0;
- pack_chat.bEmpire = d->GetEmpire();
- TEMP_BUFFER buf;
- buf.write(&pack_chat, sizeof(struct packet_chat));
- buf.write(chatbuf, len);
- d->Packet(buf.read_peek(), buf.size());
- if (type == CHAT_TYPE_COMMAND && test_server)
- sys_log(0, "SEND_COMMAND %s %s", GetName(), chatbuf);
- }
- // MINING
- void CHARACTER::mining_take()
- {
- m_pkMiningEvent = NULL;
- }
- void CHARACTER::mining_cancel()
- {
- if (m_pkMiningEvent)
- {
- sys_log(0, "XXX MINING CANCEL");
- event_cancel(&m_pkMiningEvent);
- ChatPacket(CHAT_TYPE_INFO, LC_TEXT("䱤À» Áß´ÜÇÏ¿´½À´Ï´Ù."));
- }
- }
- void CHARACTER::mining(LPCHARACTER chLoad)
- {
- if (m_pkMiningEvent)
- {
- mining_cancel();
- return;
- }
- if (!chLoad)
- return;
- if (mining::GetRawOreFromLoad(chLoad->GetRaceNum()) == 0)
- return;
- LPITEM pick = GetWear(WEAR_WEAPON);
- if (!pick || pick->GetType() != ITEM_PICK)
- {
- ChatPacket(CHAT_TYPE_INFO, LC_TEXT("°î±ªÀ̸¦ ÀåÂøÇϼ¼¿ä."));
- return;
- }
- int count = number(5, 15); // µ¿ÀÛ È½¼ö, ÇÑ µ¿ÀÛ´ç 2ÃÊ
- // 䱤 µ¿ÀÛÀ» º¸¿©ÁÜ
- TPacketGCDigMotion p;
- p.header = HEADER_GC_DIG_MOTION;
- p.vid = GetVID();
- p.target_vid = chLoad->GetVID();
- p.count = count;
- PacketAround(&p, sizeof(p));
- m_pkMiningEvent = mining::CreateMiningEvent(this, chLoad, count);
- }
- // END_OF_MINING
- void CHARACTER::fishing()
- {
- if (m_pkFishingEvent)
- {
- fishing_take();
- return;
- }
- // ¸ø°¨ ¼Ó¼º¿¡¼ ³¬½Ã¸¦ ½ÃµµÇÑ´Ù?
- {
- LPSECTREE_MAP pkSectreeMap = SECTREE_MANAGER::instance().GetMap(GetMapIndex());
- int x = GetX();
- int y = GetY();
- LPSECTREE tree = pkSectreeMap->Find(x, y);
- DWORD dwAttr = tree->GetAttribute(x, y);
- if (IS_SET(dwAttr, ATTR_BLOCK))
- {
- ChatPacket(CHAT_TYPE_INFO, LC_TEXT("³¬½Ã¸¦ ÇÒ ¼ö ÀÖ´Â °÷ÀÌ ¾Æ´Õ´Ï´Ù"));
- return;
- }
- }
- LPITEM rod = GetWear(WEAR_WEAPON);
- // ³¬½Ã´ë ÀåÂø
- if (!rod || rod->GetType() != ITEM_ROD)
- {
- ChatPacket(CHAT_TYPE_INFO, LC_TEXT("³¬½Ã´ë¸¦ ÀåÂø Çϼ¼¿ä."));
- return;
- }
- if (0 == rod->GetSocket(2))
- {
- ChatPacket(CHAT_TYPE_INFO, LC_TEXT("¹Ì³¢¸¦ ³¢°í ´øÁ® ÁÖ¼¼¿ä."));
- return;
- }
- float fx, fy;
- GetDeltaByDegree(GetRotation(), 400.0f, &fx, &fy);
- m_pkFishingEvent = fishing::CreateFishingEvent(this);
- }
- void CHARACTER::fishing_take()
- {
- LPITEM rod = GetWear(WEAR_WEAPON);
- if (rod && rod->GetType() == ITEM_ROD)
- {
- using fishing::fishing_event_info;
- if (m_pkFishingEvent)
- {
- struct fishing_event_info* info = dynamic_cast<struct fishing_event_info*>(m_pkFishingEvent->info);
- if (info)
- fishing::Take(info, this);
- }
- }
- else
- {
- ChatPacket(CHAT_TYPE_INFO, LC_TEXT("³¬½Ã´ë°¡ ¾Æ´Ñ ¹°°ÇÀ¸·Î ³¬½Ã¸¦ ÇÒ ¼ö ¾ø½À´Ï´Ù!"));
- }
- event_cancel(&m_pkFishingEvent);
- }
- bool CHARACTER::StartStateMachine(int iNextPulse)
- {
- if (CHARACTER_MANAGER::instance().AddToStateList(this))
- {
- m_dwNextStatePulse = thecore_heart->pulse + iNextPulse;
- return true;
- }
- return false;
- }
- void CHARACTER::StopStateMachine()
- {
- CHARACTER_MANAGER::instance().RemoveFromStateList(this);
- }
- void CHARACTER::UpdateStateMachine(DWORD dwPulse)
- {
- if (dwPulse < m_dwNextStatePulse)
- return;
- if (IsDead())
- return;
- Update();
- m_dwNextStatePulse = dwPulse + m_dwStateDuration;
- }
- void CHARACTER::SetNextStatePulse(int iNextPulse)
- {
- CHARACTER_MANAGER::instance().AddToStateList(this);
- m_dwNextStatePulse = iNextPulse;
- if (iNextPulse < 10)
- MonsterLog("´ÙÀ½»óÅ·ξ¡ÀÚ");
- }
- // ij¸¯ÅÍ ÀνºÅϽº ¾÷µ¥ÀÌÆ® ÇÔ¼ö.
- void CHARACTER::UpdateCharacter(DWORD dwPulse)
- {
- CFSM::Update();
- }
- void CHARACTER::SetShop(LPSHOP pkShop)
- {
- if ((m_pkShop = pkShop))
- SET_BIT(m_pointsInstant.instant_flag, INSTANT_FLAG_SHOP);
- else
- {
- REMOVE_BIT(m_pointsInstant.instant_flag, INSTANT_FLAG_SHOP);
- SetShopOwner(NULL);
- }
- }
- void CHARACTER::SetExchange(CExchange * pkExchange)
- {
- m_pkExchange = pkExchange;
- }
- void CHARACTER::SetPart(BYTE bPartPos, WORD wVal)
- {
- assert(bPartPos < PART_MAX_NUM);
- m_pointsInstant.parts[bPartPos] = wVal;
- }
- WORD CHARACTER::GetPart(BYTE bPartPos) const
- {
- assert(bPartPos < PART_MAX_NUM);
- return m_pointsInstant.parts[bPartPos];
- }
- WORD CHARACTER::GetOriginalPart(BYTE bPartPos) const
- {
- switch (bPartPos)
- {
- case PART_MAIN:
- if (!IsPC()) // PC°¡ ¾Æ´Ñ °æ¿ì ÇöÀç ÆÄÆ®¸¦ ±×´ë·Î ¸®ÅÏ
- return GetPart(PART_MAIN);
- else
- return m_pointsInstant.bBasePart;
- case PART_HAIR:
- return GetPart(PART_HAIR);
- #ifdef __SASH_SYSTEM__
- case PART_SASH:
- return GetPart(PART_SASH);
- #endif
- default:
- return 0;
- }
- }
- BYTE CHARACTER::GetCharType() const
- {
- return m_bCharType;
- }
- bool CHARACTER::SetSyncOwner(LPCHARACTER ch, bool bRemoveFromList)
- {
- // TRENT_MONSTER
- if (IS_SET(m_pointsInstant.dwAIFlag, AIFLAG_NOMOVE))
- return false;
- // END_OF_TRENT_MONSTER
- if (ch == this)
- {
- sys_err("SetSyncOwner owner == this (%p)", this);
- return false;
- }
- if (!ch)
- {
- if (bRemoveFromList && m_pkChrSyncOwner)
- {
- m_pkChrSyncOwner->m_kLst_pkChrSyncOwned.remove(this);
- }
- if (m_pkChrSyncOwner)
- sys_log(1, "SyncRelease %s %p from %s", GetName(), this, m_pkChrSyncOwner->GetName());
- // ¸®½ºÆ®¿¡¼ Á¦°ÅÇÏÁö ¾Ê´õ¶óµµ Æ÷ÀÎÅÍ´Â NULL·Î ¼ÂÆõǾî¾ß ÇÑ´Ù.
- m_pkChrSyncOwner = NULL;
- }
- else
- {
- if (!IsSyncOwner(ch))
- return false;
- // °Å¸®°¡ 200 ÀÌ»óÀ̸é SyncOwner°¡ µÉ ¼ö ¾ø´Ù.
- if (DISTANCE_APPROX(GetX() - ch->GetX(), GetY() - ch->GetY()) > 250)
- {
- sys_log(1, "SetSyncOwner distance over than 250 %s %s", GetName(), ch->GetName());
- // SyncOwnerÀÏ °æ¿ì Owner·Î Ç¥½ÃÇÑ´Ù.
- if (m_pkChrSyncOwner == ch)
- return true;
- return false;
- }
- if (m_pkChrSyncOwner != ch)
- {
- if (m_pkChrSyncOwner)
- {
- sys_log(1, "SyncRelease %s %p from %s", GetName(), this, m_pkChrSyncOwner->GetName());
- m_pkChrSyncOwner->m_kLst_pkChrSyncOwned.remove(this);
- }
- m_pkChrSyncOwner = ch;
- m_pkChrSyncOwner->m_kLst_pkChrSyncOwned.push_back(this);
- // SyncOwner°¡ ¹Ù²î¸é LastSyncTimeÀ» ÃʱâÈÇÑ´Ù.
- static const timeval zero_tv = {0, 0};
- SetLastSyncTime(zero_tv);
- sys_log(1, "SetSyncOwner set %s %p to %s", GetName(), this, ch->GetName());
- }
- m_fSyncTime = get_float_time();
- }
- // TODO: Sync Owner°¡ °°´õ¶óµµ °è¼Ó ÆÐŶÀ» º¸³»°í ÀÖÀ¸¹Ç·Î,
- // µ¿±âÈ µÈ ½Ã°£ÀÌ 3ÃÊ ÀÌ»ó Áö³µÀ» ¶§ Ç®¾îÁÖ´Â ÆÐŶÀ»
- // º¸³»´Â ¹æ½ÄÀ¸·Î Çϸé ÆÐŶÀ» ÁÙÀÏ ¼ö ÀÖ´Ù.
- TPacketGCOwnership pack;
- pack.bHeader = HEADER_GC_OWNERSHIP;
- pack.dwOwnerVID = ch ? ch->GetVID() : 0;
- pack.dwVictimVID = GetVID();
- PacketAround(&pack, sizeof(TPacketGCOwnership));
- return true;
- }
- struct FuncClearSync
- {
- void operator () (LPCHARACTER ch)
- {
- assert(ch != NULL);
- ch->SetSyncOwner(NULL, false); // false Ç÷¡±×·Î ÇØ¾ß for_each °¡ Á¦´ë·Î µ·´Ù.
- }
- };
- void CHARACTER::ClearSync()
- {
- SetSyncOwner(NULL);
- // ¾Æ·¡ for_each¿¡¼ ³ª¸¦ m_pkChrSyncOwner·Î °¡Áø ÀÚµéÀÇ Æ÷ÀÎÅ͸¦ NULL·Î ÇÑ´Ù.
- std::for_each(m_kLst_pkChrSyncOwned.begin(), m_kLst_pkChrSyncOwned.end(), FuncClearSync());
- m_kLst_pkChrSyncOwned.clear();
- }
- bool CHARACTER::IsSyncOwner(LPCHARACTER ch) const
- {
- if (m_pkChrSyncOwner == ch)
- return true;
- // ¸¶Áö¸·À¸·Î µ¿±âÈ µÈ ½Ã°£ÀÌ 3ÃÊ ÀÌ»ó Áö³µ´Ù¸é ¼ÒÀ¯±ÇÀÌ ¾Æ¹«¿¡°Ôµµ
- // ¾ø´Ù. µû¶ó¼ ¾Æ¹«³ª SyncOwnerÀ̹ǷΠtrue ¸®ÅÏ
- if (get_float_time() - m_fSyncTime >= 3.0f)
- return true;
- return false;
- }
- void CHARACTER::SetParty(LPPARTY pkParty)
- {
- if (pkParty == m_pkParty)
- return;
- if (pkParty && m_pkParty)
- sys_err("%s is trying to reassigning party (current %p, new party %p)", GetName(), get_pointer(m_pkParty), get_pointer(pkParty));
- sys_log(1, "PARTY set to %p", get_pointer(pkParty));
- //if (m_pkDungeon && IsPC())
- //SetDungeon(NULL);
- m_pkParty = pkParty;
- if (IsPC())
- {
- if (m_pkParty)
- SET_BIT(m_bAddChrState, ADD_CHARACTER_STATE_PARTY);
- else
- REMOVE_BIT(m_bAddChrState, ADD_CHARACTER_STATE_PARTY);
- UpdatePacket();
- }
- }
- // PARTY_JOIN_BUG_FIX
- /// ÆÄƼ °¡ÀÔ event Á¤º¸
- EVENTINFO(TPartyJoinEventInfo)
- {
- DWORD dwGuestPID; ///< ÆÄƼ¿¡ Âü¿©ÇÒ Ä³¸¯ÅÍÀÇ PID
- DWORD dwLeaderPID; ///< ÆÄƼ ¸®´õÀÇ PID
- TPartyJoinEventInfo()
- : dwGuestPID( 0 )
- , dwLeaderPID( 0 )
- {
- }
- } ;
- EVENTFUNC(party_request_event)
- {
- TPartyJoinEventInfo * info = dynamic_cast<TPartyJoinEventInfo *>( event->info );
- if ( info == NULL )
- {
- sys_err( "party_request_event> <Factor> Null pointer" );
- return 0;
- }
- LPCHARACTER ch = CHARACTER_MANAGER::instance().FindByPID(info->dwGuestPID);
- if (ch)
- {
- sys_log(0, "PartyRequestEvent %s", ch->GetName());
- ch->ChatPacket(CHAT_TYPE_COMMAND, "PartyRequestDenied");
- ch->SetPartyRequestEvent(NULL);
- }
- return 0;
- }
- bool CHARACTER::RequestToParty(LPCHARACTER leader)
- {
- if (leader->GetParty())
- leader = leader->GetParty()->GetLeaderCharacter();
- if (!leader)
- {
- ChatPacket(CHAT_TYPE_INFO, LC_TEXT("ÆÄƼÀåÀÌ Á¢¼Ó »óÅ°¡ ¾Æ´Ï¶ó¼ ¿äûÀ» ÇÒ ¼ö ¾ø½À´Ï´Ù."));
- return false;
- }
- if (m_pkPartyRequestEvent)
- return false;
- if (!IsPC() || !leader->IsPC())
- return false;
- if (leader->IsBlockMode(BLOCK_PARTY_REQUEST))
- return false;
- PartyJoinErrCode errcode = IsPartyJoinableCondition(leader, this);
- switch (errcode)
- {
- case PERR_NONE:
- break;
- case PERR_SERVER:
- ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<ÆÄƼ> ¼¹ö ¹®Á¦·Î ÆÄƼ °ü·Ã 󸮸¦ ÇÒ ¼ö ¾ø½À´Ï´Ù."));
- return false;
- case PERR_DIFFEMPIRE:
- ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<ÆÄƼ> ´Ù¸¥ Á¦±¹°ú ÆÄƼ¸¦ ÀÌ·ê ¼ö ¾ø½À´Ï´Ù."));
- return false;
- case PERR_DUNGEON:
- ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<ÆÄƼ> ´øÀü ¾È¿¡¼´Â ÆÄƼ Ãʴ븦 ÇÒ ¼ö ¾ø½À´Ï´Ù."));
- return false;
- case PERR_OBSERVER:
- ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<ÆÄƼ> °üÀü ¸ðµå¿¡¼± ÆÄƼ Ãʴ븦 ÇÒ ¼ö ¾ø½À´Ï´Ù."));
- return false;
- case PERR_LVBOUNDARY:
- ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<ÆÄƼ> -30 ~ +30 ·¹º§ À̳»ÀÇ »ó´ë¹æ¸¸ ÃÊ´ëÇÒ ¼ö ÀÖ½À´Ï´Ù."));
- return false;
- case PERR_LOWLEVEL:
- ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<ÆÄƼ> ÆÄƼ³» ÃÖ°í ·¹º§ º¸´Ù 30·¹º§ÀÌ ³·¾Æ ÃÊ´ëÇÒ ¼ö ¾ø½À´Ï´Ù."));
- return false;
- case PERR_HILEVEL:
- ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<ÆÄƼ> ÆÄƼ³» ÃÖÀú ·¹º§ º¸´Ù 30·¹º§ÀÌ ³ô¾Æ ÃÊ´ëÇÒ ¼ö ¾ø½À´Ï´Ù."));
- return false;
- case PERR_ALREADYJOIN:
- return false;
- case PERR_PARTYISFULL:
- ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<ÆÄƼ> ´õ ÀÌ»ó ÆÄƼ¿øÀ» ÃÊ´ëÇÒ ¼ö ¾ø½À´Ï´Ù."));
- return false;
- default:
- sys_err("Do not process party join error(%d)", errcode);
- return false;
- }
- TPartyJoinEventInfo* info = AllocEventInfo<TPartyJoinEventInfo>();
- info->dwGuestPID = GetPlayerID();
- info->dwLeaderPID = leader->GetPlayerID();
- SetPartyRequestEvent(event_create(party_request_event, info, PASSES_PER_SEC(10)));
- leader->ChatPacket(CHAT_TYPE_COMMAND, "PartyRequest %u", (DWORD) GetVID());
- ChatPacket(CHAT_TYPE_INFO, LC_TEXT("%s ´Ô¿¡°Ô ÆÄƼ°¡ÀÔ ½ÅûÀ» Çß½À´Ï´Ù."), leader->GetName());
- return true;
- }
- void CHARACTER::DenyToParty(LPCHARACTER member)
- {
- sys_log(1, "DenyToParty %s member %s %p", GetName(), member->GetName(), get_pointer(member->m_pkPartyRequestEvent));
- if (!member->m_pkPartyRequestEvent)
- return;
- TPartyJoinEventInfo * info = dynamic_cast<TPartyJoinEventInfo *>(member->m_pkPartyRequestEvent->info);
- if (!info)
- {
- sys_err( "CHARACTER::DenyToParty> <Factor> Null pointer" );
- return;
- }
- if (info->dwGuestPID != member->GetPlayerID())
- return;
- if (info->dwLeaderPID != GetPlayerID())
- return;
- event_cancel(&member->m_pkPartyRequestEvent);
- member->ChatPacket(CHAT_TYPE_COMMAND, "PartyRequestDenied");
- }
- void CHARACTER::AcceptToParty(LPCHARACTER member)
- {
- sys_log(1, "AcceptToParty %s member %s %p", GetName(), member->GetName(), get_pointer(member->m_pkPartyRequestEvent));
- if (!member->m_pkPartyRequestEvent)
- return;
- TPartyJoinEventInfo * info = dynamic_cast<TPartyJoinEventInfo *>(member->m_pkPartyRequestEvent->info);
- if (!info)
- {
- sys_err( "CHARACTER::AcceptToParty> <Factor> Null pointer" );
- return;
- }
- if (info->dwGuestPID != member->GetPlayerID())
- return;
- if (info->dwLeaderPID != GetPlayerID())
- return;
- event_cancel(&member->m_pkPartyRequestEvent);
- if (!GetParty())
- member->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("»ó´ë¹æÀÌ ÆÄƼ¿¡ ¼ÓÇØÀÖÁö ¾Ê½À´Ï´Ù."));
- else
- {
- if (GetPlayerID() != GetParty()->GetLeaderPID())
- return;
- PartyJoinErrCode errcode = IsPartyJoinableCondition(this, member);
- switch (errcode)
- {
- case PERR_NONE: member->PartyJoin(this); return;
- case PERR_SERVER: member->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<ÆÄƼ> ¼¹ö ¹®Á¦·Î ÆÄƼ °ü·Ã 󸮸¦ ÇÒ ¼ö ¾ø½À´Ï´Ù.")); break;
- case PERR_DUNGEON: member->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<ÆÄƼ> ´øÀü ¾È¿¡¼´Â ÆÄƼ Ãʴ븦 ÇÒ ¼ö ¾ø½À´Ï´Ù.")); break;
- case PERR_OBSERVER: member->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<ÆÄƼ> °üÀü ¸ðµå¿¡¼± ÆÄƼ Ãʴ븦 ÇÒ ¼ö ¾ø½À´Ï´Ù.")); break;
- case PERR_LVBOUNDARY: member->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<ÆÄƼ> -30 ~ +30 ·¹º§ À̳»ÀÇ »ó´ë¹æ¸¸ ÃÊ´ëÇÒ ¼ö ÀÖ½À´Ï´Ù.")); break;
- case PERR_LOWLEVEL: member->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<ÆÄƼ> ÆÄƼ³» ÃÖ°í ·¹º§ º¸´Ù 30·¹º§ÀÌ ³·¾Æ ÃÊ´ëÇÒ ¼ö ¾ø½À´Ï´Ù.")); break;
- case PERR_HILEVEL: member->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<ÆÄƼ> ÆÄƼ³» ÃÖÀú ·¹º§ º¸´Ù 30·¹º§ÀÌ ³ô¾Æ ÃÊ´ëÇÒ ¼ö ¾ø½À´Ï´Ù.")); break;
- case PERR_ALREADYJOIN: break;
- case PERR_PARTYISFULL: {
- ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<ÆÄƼ> ´õ ÀÌ»ó ÆÄƼ¿øÀ» ÃÊ´ëÇÒ ¼ö ¾ø½À´Ï´Ù."));
- member->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<ÆÄƼ> ÆÄƼÀÇ ÀοøÁ¦ÇÑÀÌ ÃÊ°úÇÏ¿© ÆÄƼ¿¡ Âü°¡ÇÒ ¼ö ¾ø½À´Ï´Ù."));
- break;
- }
- default: sys_err("Do not process party join error(%d)", errcode);
- }
- }
- member->ChatPacket(CHAT_TYPE_COMMAND, "PartyRequestDenied");
- }
- /**
- * ÆÄƼ ÃÊ´ë event callback ÇÔ¼ö.
- * event °¡ ¹ßµ¿Çϸé ÃÊ´ë °ÅÀý·Î ó¸®ÇÑ´Ù.
- */
- EVENTFUNC(party_invite_event)
- {
- TPartyJoinEventInfo * pInfo = dynamic_cast<TPartyJoinEventInfo *>( event->info );
- if ( pInfo == NULL )
- {
- sys_err( "party_invite_event> <Factor> Null pointer" );
- return 0;
- }
- LPCHARACTER pchInviter = CHARACTER_MANAGER::instance().FindByPID(pInfo->dwLeaderPID);
- if (pchInviter)
- {
- sys_log(1, "PartyInviteEvent %s", pchInviter->GetName());
- pchInviter->PartyInviteDeny(pInfo->dwGuestPID);
- }
- return 0;
- }
- void CHARACTER::PartyInvite(LPCHARACTER pchInvitee)
- {
- if (GetParty() && GetParty()->GetLeaderPID() != GetPlayerID())
- {
- ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<ÆÄƼ> ÆÄƼ¿øÀ» ÃÊ´ëÇÒ ¼ö ÀÖ´Â ±ÇÇÑÀÌ ¾ø½À´Ï´Ù."));
- return;
- }
- else if (pchInvitee->IsBlockMode(BLOCK_PARTY_INVITE))
- {
- ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<ÆÄƼ> %s ´ÔÀÌ ÆÄƼ °ÅºÎ »óÅÂÀÔ´Ï´Ù."), pchInvitee->GetName());
- return;
- }
- PartyJoinErrCode errcode = IsPartyJoinableCondition(this, pchInvitee);
- switch (errcode)
- {
- case PERR_NONE:
- break;
- case PERR_SERVER:
- ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<ÆÄƼ> ¼¹ö ¹®Á¦·Î ÆÄƼ °ü·Ã 󸮸¦ ÇÒ ¼ö ¾ø½À´Ï´Ù."));
- return;
- case PERR_DIFFEMPIRE:
- ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<ÆÄƼ> ´Ù¸¥ Á¦±¹°ú ÆÄƼ¸¦ ÀÌ·ê ¼ö ¾ø½À´Ï´Ù."));
- return;
- case PERR_DUNGEON:
- ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<ÆÄƼ> ´øÀü ¾È¿¡¼´Â ÆÄƼ Ãʴ븦 ÇÒ ¼ö ¾ø½À´Ï´Ù."));
- return;
- case PERR_OBSERVER:
- ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<ÆÄƼ> °üÀü ¸ðµå¿¡¼± ÆÄƼ Ãʴ븦 ÇÒ ¼ö ¾ø½À´Ï´Ù."));
- return;
- case PERR_LVBOUNDARY:
- ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<ÆÄƼ> -30 ~ +30 ·¹º§ À̳»ÀÇ »ó´ë¹æ¸¸ ÃÊ´ëÇÒ ¼ö ÀÖ½À´Ï´Ù."));
- return;
- case PERR_LOWLEVEL:
- ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<ÆÄƼ> ÆÄƼ³» ÃÖ°í ·¹º§ º¸´Ù 30·¹º§ÀÌ ³·¾Æ ÃÊ´ëÇÒ ¼ö ¾ø½À´Ï´Ù."));
- return;
- case PERR_HILEVEL:
- ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<ÆÄƼ> ÆÄƼ³» ÃÖÀú ·¹º§ º¸´Ù 30·¹º§ÀÌ ³ô¾Æ ÃÊ´ëÇÒ ¼ö ¾ø½À´Ï´Ù."));
- return;
- case PERR_ALREADYJOIN:
- ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<ÆÄƼ> ÀÌ¹Ì %s´ÔÀº ÆÄƼ¿¡ ¼ÓÇØ ÀÖ½À´Ï´Ù."), pchInvitee->GetName());
- return;
- case PERR_PARTYISFULL:
- ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<ÆÄƼ> ´õ ÀÌ»ó ÆÄƼ¿øÀ» ÃÊ´ëÇÒ ¼ö ¾ø½À´Ï´Ù."));
- return;
- default:
- sys_err("Do not process party join error(%d)", errcode);
- return;
- }
- if (m_PartyInviteEventMap.end() != m_PartyInviteEventMap.find(pchInvitee->GetPlayerID()))
- return;
- //
- // EventMap ¿¡ À̺¥Æ® Ãß°¡
- //
- TPartyJoinEventInfo* info = AllocEventInfo<TPartyJoinEventInfo>();
- info->dwGuestPID = pchInvitee->GetPlayerID();
- info->dwLeaderPID = GetPlayerID();
- m_PartyInviteEventMap.insert(EventMap::value_type(pchInvitee->GetPlayerID(), event_create(party_invite_event, info, PASSES_PER_SEC(10))));
- //
- // ÃÊ´ë ¹Þ´Â character ¿¡°Ô ÃÊ´ë ÆÐŶ Àü¼Û
- //
- TPacketGCPartyInvite p;
- p.header = HEADER_GC_PARTY_INVITE;
- p.leader_vid = GetVID();
- pchInvitee->GetDesc()->Packet(&p, sizeof(p));
- }
- void CHARACTER::PartyInviteAccept(LPCHARACTER pchInvitee)
- {
- EventMap::iterator itFind = m_PartyInviteEventMap.find(pchInvitee->GetPlayerID());
- if (itFind == m_PartyInviteEventMap.end())
- {
- sys_log(1, "PartyInviteAccept from not invited character(%s)", pchInvitee->GetName());
- return;
- }
- event_cancel(&itFind->second);
- m_PartyInviteEventMap.erase(itFind);
- if (GetParty() && GetParty()->GetLeaderPID() != GetPlayerID())
- {
- ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<ÆÄƼ> ÆÄƼ¿øÀ» ÃÊ´ëÇÒ ¼ö ÀÖ´Â ±ÇÇÑÀÌ ¾ø½À´Ï´Ù."));
- return;
- }
- PartyJoinErrCode errcode = IsPartyJoinableMutableCondition(this, pchInvitee);
- switch (errcode)
- {
- case PERR_NONE:
- break;
- case PERR_SERVER:
- pchInvitee->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<ÆÄƼ> ¼¹ö ¹®Á¦·Î ÆÄƼ °ü·Ã 󸮸¦ ÇÒ ¼ö ¾ø½À´Ï´Ù."));
- return;
- case PERR_DUNGEON:
- pchInvitee->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<ÆÄƼ> ´øÀü ¾È¿¡¼´Â ÆÄƼ ÃÊ´ë¿¡ ÀÀÇÒ ¼ö ¾ø½À´Ï´Ù."));
- return;
- case PERR_OBSERVER:
- pchInvitee->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<ÆÄƼ> °üÀü ¸ðµå¿¡¼± ÆÄƼ Ãʴ븦 ÇÒ ¼ö ¾ø½À´Ï´Ù."));
- return;
- case PERR_LVBOUNDARY:
- pchInvitee->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<ÆÄƼ> -30 ~ +30 ·¹º§ À̳»ÀÇ »ó´ë¹æ¸¸ ÃÊ´ëÇÒ ¼ö ÀÖ½À´Ï´Ù."));
- return;
- case PERR_LOWLEVEL:
- pchInvitee->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<ÆÄƼ> ÆÄƼ³» ÃÖ°í ·¹º§ º¸´Ù 30·¹º§ÀÌ ³·¾Æ ÃÊ´ëÇÒ ¼ö ¾ø½À´Ï´Ù."));
- return;
- case PERR_HILEVEL:
- pchInvitee->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<ÆÄƼ> ÆÄƼ³» ÃÖÀú ·¹º§ º¸´Ù 30·¹º§ÀÌ ³ô¾Æ ÃÊ´ëÇÒ ¼ö ¾ø½À´Ï´Ù."));
- return;
- case PERR_ALREADYJOIN:
- pchInvitee->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<ÆÄƼ> ÆÄƼ ÃÊ´ë¿¡ ÀÀÇÒ ¼ö ¾ø½À´Ï´Ù."));
- return;
- case PERR_PARTYISFULL:
- ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<ÆÄƼ> ´õ ÀÌ»ó ÆÄƼ¿øÀ» ÃÊ´ëÇÒ ¼ö ¾ø½À´Ï´Ù."));
- pchInvitee->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<ÆÄƼ> ÆÄƼÀÇ ÀοøÁ¦ÇÑÀÌ ÃÊ°úÇÏ¿© ÆÄƼ¿¡ Âü°¡ÇÒ ¼ö ¾ø½À´Ï´Ù."));
- return;
- default:
- sys_err("ignore party join error(%d)", errcode);
- return;
- }
- //
- // ÆÄƼ °¡ÀÔ Ã³¸®
- //
- if (GetParty())
- pchInvitee->PartyJoin(this);
- else
- {
- LPPARTY pParty = CPartyManager::instance().CreateParty(this);
- pParty->Join(pchInvitee->GetPlayerID());
- pParty->Link(pchInvitee);
- pParty->SendPartyInfoAllToOne(this);
- }
- }
- void CHARACTER::PartyInviteDeny(DWORD dwPID)
- {
- EventMap::iterator itFind = m_PartyInviteEventMap.find(dwPID);
- if (itFind == m_PartyInviteEventMap.end())
- {
- sys_log(1, "PartyInviteDeny to not exist event(inviter PID: %d, invitee PID: %d)", GetPlayerID(), dwPID);
- return;
- }
- event_cancel(&itFind->second);
- m_PartyInviteEventMap.erase(itFind);
- LPCHARACTER pchInvitee = CHARACTER_MANAGER::instance().FindByPID(dwPID);
- if (pchInvitee)
- ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<ÆÄƼ> %s´ÔÀÌ ÆÄƼ Ãʴ븦 °ÅÀýÇϼ̽À´Ï´Ù."), pchInvitee->GetName());
- }
- void CHARACTER::PartyJoin(LPCHARACTER pLeader)
- {
- pLeader->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<ÆÄƼ> %s´ÔÀÌ ÆÄƼ¿¡ Âü°¡Çϼ̽À´Ï´Ù."), GetName());
- ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<ÆÄƼ> %s´ÔÀÇ ÆÄƼ¿¡ Âü°¡Çϼ̽À´Ï´Ù."), pLeader->GetName());
- pLeader->GetParty()->Join(GetPlayerID());
- pLeader->GetParty()->Link(this);
- }
- CHARACTER::PartyJoinErrCode CHARACTER::IsPartyJoinableCondition(const LPCHARACTER pchLeader, const LPCHARACTER pchGuest)
- {
- if (pchLeader->GetEmpire() != pchGuest->GetEmpire())
- return PERR_DIFFEMPIRE;
- return IsPartyJoinableMutableCondition(pchLeader, pchGuest);
- }
- static bool __party_can_join_by_level(LPCHARACTER leader, LPCHARACTER quest)
- {
- int level_limit = 30;
- if (LC_IsCanada())
- level_limit = 15;
- else if (LC_IsBrazil() == true)
- {
- level_limit = 10;
- }
- else
- level_limit = 30;
- return (abs(leader->GetLevel() - quest->GetLevel()) <= level_limit);
- }
- CHARACTER::PartyJoinErrCode CHARACTER::IsPartyJoinableMutableCondition(const LPCHARACTER pchLeader, const LPCHARACTER pchGuest)
- {
- if (!CPartyManager::instance().IsEnablePCParty())
- return PERR_SERVER;
- else if (pchLeader->GetDungeon())
- return PERR_DUNGEON;
- else if (pchGuest->IsObserverMode())
- return PERR_OBSERVER;
- else if (false == __party_can_join_by_level(pchLeader, pchGuest))
- return PERR_LVBOUNDARY;
- else if (pchGuest->GetParty())
- return PERR_ALREADYJOIN;
- else if (pchLeader->GetParty())
- {
- if (pchLeader->GetParty()->GetMemberCount() == PARTY_MAX_MEMBER)
- return PERR_PARTYISFULL;
- }
- return PERR_NONE;
- }
- // END_OF_PARTY_JOIN_BUG_FIX
- void CHARACTER::SetDungeon(LPDUNGEON pkDungeon)
- {
- if (pkDungeon && m_pkDungeon)
- sys_err("%s is trying to reassigning dungeon (current %p, new party %p)", GetName(), get_pointer(m_pkDungeon), get_pointer(pkDungeon));
- if (m_pkDungeon == pkDungeon) {
- return;
- }
- if (m_pkDungeon)
- {
- if (IsPC())
- {
- if (GetParty())
- m_pkDungeon->DecPartyMember(GetParty(), this);
- else
- m_pkDungeon->DecMember(this);
- }
- else if (IsMonster() || IsStone())
- {
- m_pkDungeon->DecMonster();
- }
- }
- m_pkDungeon = pkDungeon;
- if (pkDungeon)
- {
- sys_log(0, "%s DUNGEON set to %p, PARTY is %p", GetName(), get_pointer(pkDungeon), get_pointer(m_pkParty));
- if (IsPC())
- {
- if (GetParty())
- m_pkDungeon->IncPartyMember(GetParty(), this);
- else
- m_pkDungeon->IncMember(this);
- }
- else if (IsMonster() || IsStone())
- {
- m_pkDungeon->IncMonster();
- }
- }
- }
- void CHARACTER::SetWarMap(CWarMap * pWarMap)
- {
- if (m_pWarMap)
- m_pWarMap->DecMember(this);
- m_pWarMap = pWarMap;
- if (m_pWarMap)
- m_pWarMap->IncMember(this);
- }
- void CHARACTER::SetWeddingMap(marriage::WeddingMap* pMap)
- {
- if (m_pWeddingMap)
- m_pWeddingMap->DecMember(this);
- m_pWeddingMap = pMap;
- if (m_pWeddingMap)
- m_pWeddingMap->IncMember(this);
- }
- void CHARACTER::SetRegen(LPREGEN pkRegen)
- {
- m_pkRegen = pkRegen;
- if (pkRegen != NULL) {
- regen_id_ = pkRegen->id;
- }
- m_fRegenAngle = GetRotation();
- m_posRegen = GetXYZ();
- }
- bool CHARACTER::OnIdle()
- {
- return false;
- }
- void CHARACTER::OnMove(bool bIsAttack)
- {
- m_dwLastMoveTime = get_dword_time();
- if (bIsAttack)
- {
- m_dwLastAttackTime = m_dwLastMoveTime;
- if (IsAffectFlag(AFF_REVIVE_INVISIBLE))
- RemoveAffect(AFFECT_REVIVE_INVISIBLE);
- if (IsAffectFlag(AFF_EUNHYUNG))
- {
- RemoveAffect(SKILL_EUNHYUNG);
- SetAffectedEunhyung();
- }
- else
- {
- ClearAffectedEunhyung();
- }
- /*if (IsAffectFlag(AFF_JEONSIN))
- RemoveAffect(SKILL_JEONSINBANGEO);*/
- }
- /*if (IsAffectFlag(AFF_GUNGON))
- RemoveAffect(SKILL_GUNGON);*/
- // MINING
- mining_cancel();
- // END_OF_MINING
- }
- void CHARACTER::OnClick(LPCHARACTER pkChrCauser)
- {
- if (!pkChrCauser)
- {
- sys_err("OnClick %s by NULL", GetName());
- return;
- }
- DWORD vid = GetVID();
- sys_log(0, "OnClick %s[vnum %d ServerUniqueID %d, pid %d] by %s", GetName(), GetRaceNum(), vid, GetPlayerID(), pkChrCauser->GetName());
- // »óÁ¡À» ¿¬»óÅ·ΠÄù½ºÆ®¸¦ ÁøÇàÇÒ ¼ö ¾ø´Ù.
- {
- // ´Ü, ÀÚ½ÅÀº ÀÚ½ÅÀÇ »óÁ¡À» Ŭ¸¯ÇÒ ¼ö ÀÖ´Ù.
- if (pkChrCauser->GetMyShop() && pkChrCauser != this)
- {
- sys_err("OnClick Fail (%s->%s) - pc has shop", pkChrCauser->GetName(), GetName());
- return;
- }
- }
- // ±³È¯ÁßÀ϶§ Äù½ºÆ®¸¦ ÁøÇàÇÒ ¼ö ¾ø´Ù.
- {
- if (pkChrCauser->GetExchange())
- {
- sys_err("OnClick Fail (%s->%s) - pc is exchanging", pkChrCauser->GetName(), GetName());
- return;
- }
- }
- if (IsPC())
- {
- // Ÿ°ÙÀ¸·Î ¼³Á¤µÈ °æ¿ì´Â PC¿¡ ÀÇÇÑ Å¬¸¯µµ Äù½ºÆ®·Î ó¸®Çϵµ·Ï ÇÕ´Ï´Ù.
- if (!CTargetManager::instance().GetTargetInfo(pkChrCauser->GetPlayerID(), TARGET_TYPE_VID, GetVID()))
- {
- // 2005.03.17.myevan.Ÿ°ÙÀÌ ¾Æ´Ñ °æ¿ì´Â °³ÀÎ »óÁ¡ ó¸® ±â´ÉÀ» ÀÛµ¿½ÃŲ´Ù.
- if (GetMyShop())
- {
- if (pkChrCauser->IsDead() == true) return;
- //PREVENT_TRADE_WINDOW
- if (pkChrCauser == this) // ÀÚ±â´Â °¡´É
- {
- if ((GetExchange() || IsOpenSafebox() || GetShopOwner()) || IsCubeOpen())
- {
- pkChrCauser->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("´Ù¸¥ °Å·¡Áß(â°í,±³È¯,»óÁ¡)¿¡´Â °³ÀλóÁ¡À» »ç¿ëÇÒ ¼ö ¾ø½À´Ï´Ù."));
- return;
- }
- }
- else // ´Ù¸¥ »ç¶÷ÀÌ Å¬¸¯ÇßÀ»¶§
- {
- // Ŭ¸¯ÇÑ »ç¶÷ÀÌ ±³È¯/â°í/°³ÀλóÁ¡/»óÁ¡ÀÌ¿ëÁßÀ̶ó¸é ºÒ°¡
- if ((pkChrCauser->GetExchange() || pkChrCauser->IsOpenSafebox() || pkChrCauser->GetMyShop() || pkChrCauser->GetShopOwner()) || pkChrCauser->IsCubeOpen() )
- {
- pkChrCauser->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("´Ù¸¥ °Å·¡Áß(â°í,±³È¯,»óÁ¡)¿¡´Â °³ÀλóÁ¡À» »ç¿ëÇÒ ¼ö ¾ø½À´Ï´Ù."));
- return;
- }
- // Ŭ¸¯ÇÑ ´ë»óÀÌ ±³È¯/â°í/»óÁ¡ÀÌ¿ëÁßÀ̶ó¸é ºÒ°¡
- //if ((GetExchange() || IsOpenSafebox() || GetShopOwner()))
- if ((GetExchange() || IsOpenSafebox() || IsCubeOpen()))
- {
- pkChrCauser->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("»ó´ë¹æÀÌ ´Ù¸¥ °Å·¡¸¦ ÇÏ°í ÀÖ´Â ÁßÀÔ´Ï´Ù."));
- return;
- }
- }
- //END_PREVENT_TRADE_WINDOW
- if (pkChrCauser->GetShop())
- {
- pkChrCauser->GetShop()->RemoveGuest(pkChrCauser);
- pkChrCauser->SetShop(NULL);
- }
- GetMyShop()->AddGuest(pkChrCauser, GetVID(), false);
- pkChrCauser->SetShopOwner(this);
- return;
- }
- if (test_server)
- sys_err("%s.OnClickFailure(%s) - target is PC", pkChrCauser->GetName(), GetName());
- return;
- }
- }
- // û¼Ò³âÀº Äù½ºÆ® ¸øÇÔ
- if (LC_IsNewCIBN())
- {
- if (pkChrCauser->IsOverTime(OT_3HOUR))
- {
- sys_log(0, "Teen OverTime : name = %s, hour = %d)", pkChrCauser->GetName(), 3);
- return;
- }
- else if (pkChrCauser->IsOverTime(OT_5HOUR))
- {
- sys_log(0, "Teen OverTime : name = %s, hour = %d)", pkChrCauser->GetName(), 5);
- return;
- }
- }
- pkChrCauser->SetQuestNPCID(GetVID());
- if (quest::CQuestManager::instance().Click(pkChrCauser->GetPlayerID(), this))
- {
- return;
- }
- // NPC Àü¿ë ±â´É ¼öÇà : »óÁ¡ ¿±â µî
- if (!IsPC())
- {
- if (!m_triggerOnClick.pFunc)
- {
- // NPC Æ®¸®°Å ½Ã½ºÅÛ ·Î±× º¸±â
- //sys_err("%s.OnClickFailure(%s) : triggerOnClick.pFunc is EMPTY(pid=%d)",
- // pkChrCauser->GetName(),
- // GetName(),
- // pkChrCauser->GetPlayerID());
- return;
- }
- m_triggerOnClick.pFunc(this, pkChrCauser);
- }
- }
- BYTE CHARACTER::GetGMLevel() const
- {
- if (test_server)
- return GM_IMPLEMENTOR;
- return m_pointsInstant.gm_level;
- }
- void CHARACTER::SetGMLevel()
- {
- if (GetDesc())
- {
- m_pointsInstant.gm_level = gm_get_level(GetName(), GetDesc()->GetHostName(), GetDesc()->GetAccountTable().login);
- }
- else
- {
- m_pointsInstant.gm_level = GM_PLAYER;
- }
- }
- BOOL CHARACTER::IsGM() const
- {
- if (m_pointsInstant.gm_level != GM_PLAYER)
- return true;
- if (test_server)
- return true;
- return false;
- }
- void CHARACTER::SetStone(LPCHARACTER pkChrStone)
- {
- m_pkChrStone = pkChrStone;
- if (m_pkChrStone)
- {
- if (pkChrStone->m_set_pkChrSpawnedBy.find(this) == pkChrStone->m_set_pkChrSpawnedBy.end())
- pkChrStone->m_set_pkChrSpawnedBy.insert(this);
- }
- }
- struct FuncDeadSpawnedByStone
- {
- void operator () (LPCHARACTER ch)
- {
- ch->Dead(NULL);
- ch->SetStone(NULL);
- }
- };
- void CHARACTER::ClearStone()
- {
- if (!m_set_pkChrSpawnedBy.empty())
- {
- // ³»°¡ ½ºÆù½ÃŲ ¸ó½ºÅ͵éÀ» ¸ðµÎ Á×ÀδÙ.
- FuncDeadSpawnedByStone f;
- std::for_each(m_set_pkChrSpawnedBy.begin(), m_set_pkChrSpawnedBy.end(), f);
- m_set_pkChrSpawnedBy.clear();
- }
- if (!m_pkChrStone)
- return;
- m_pkChrStone->m_set_pkChrSpawnedBy.erase(this);
- m_pkChrStone = NULL;
- }
- void CHARACTER::ClearTarget()
- {
- if (m_pkChrTarget)
- {
- m_pkChrTarget->m_set_pkChrTargetedBy.erase(this);
- m_pkChrTarget = NULL;
- }
- TPacketGCTarget p;
- p.header = HEADER_GC_TARGET;
- p.dwVID = 0;
- p.bHPPercent = 0;
- CHARACTER_SET::iterator it = m_set_pkChrTargetedBy.begin();
- while (it != m_set_pkChrTargetedBy.end())
- {
- LPCHARACTER pkChr = *(it++);
- pkChr->m_pkChrTarget = NULL;
- if (!pkChr->GetDesc())
- {
- sys_err("%s %p does not have desc", pkChr->GetName(), get_pointer(pkChr));
- abort();
- }
- pkChr->GetDesc()->Packet(&p, sizeof(TPacketGCTarget));
- }
- m_set_pkChrTargetedBy.clear();
- }
- void CHARACTER::SetTarget(LPCHARACTER pkChrTarget)
- {
- if (m_pkChrTarget == pkChrTarget)
- return;
- // CASTLE
- if (IS_CASTLE_MAP(GetMapIndex()) && !IsGM())
- return;
- // CASTLE
- if (m_pkChrTarget)
- m_pkChrTarget->m_set_pkChrTargetedBy.erase(this);
- m_pkChrTarget = pkChrTarget;
- TPacketGCTarget p;
- p.header = HEADER_GC_TARGET;
- if (m_pkChrTarget)
- {
- m_pkChrTarget->m_set_pkChrTargetedBy.insert(this);
- p.dwVID = m_pkChrTarget->GetVID();
- if (m_pkChrTarget->IsPC() && !m_pkChrTarget->IsPolymorphed() || m_pkChrTarget->GetMaxHP() <= 0)
- p.bHPPercent = 0;
- else
- {
- if (m_pkChrTarget->GetRaceNum() == 20101 ||
- m_pkChrTarget->GetRaceNum() == 20102 ||
- m_pkChrTarget->GetRaceNum() == 20103 ||
- m_pkChrTarget->GetRaceNum() == 20104 ||
- m_pkChrTarget->GetRaceNum() == 20105 ||
- m_pkChrTarget->GetRaceNum() == 20106 ||
- m_pkChrTarget->GetRaceNum() == 20107 ||
- m_pkChrTarget->GetRaceNum() == 20108 ||
- m_pkChrTarget->GetRaceNum() == 20109)
- {
- LPCHARACTER owner = m_pkChrTarget->GetVictim();
- if (owner)
- {
- int iHorseHealth = owner->GetHorseHealth();
- int iHorseMaxHealth = owner->GetHorseMaxHealth();
- if (iHorseMaxHealth)
- p.bHPPercent = MINMAX(0, iHorseHealth * 100 / iHorseMaxHealth, 100);
- else
- p.bHPPercent = 100;
- }
- else
- p.bHPPercent = 100;
- }
- else
- p.bHPPercent = MINMAX(0, (m_pkChrTarget->GetHP() * 100) / m_pkChrTarget->GetMaxHP(), 100);
- }
- }
- else
- {
- p.dwVID = 0;
- p.bHPPercent = 0;
- }
- GetDesc()->Packet(&p, sizeof(TPacketGCTarget));
- }
- void CHARACTER::BroadcastTargetPacket()
- {
- if (m_set_pkChrTargetedBy.empty())
- return;
- TPacketGCTarget p;
- p.header = HEADER_GC_TARGET;
- p.dwVID = GetVID();
- if (IsPC())
- p.bHPPercent = 0;
- else
- p.bHPPercent = MINMAX(0, (GetHP() * 100) / GetMaxHP(), 100);
- CHARACTER_SET::iterator it = m_set_pkChrTargetedBy.begin();
- while (it != m_set_pkChrTargetedBy.end())
- {
- LPCHARACTER pkChr = *it++;
- if (!pkChr->GetDesc())
- {
- sys_err("%s %p does not have desc", pkChr->GetName(), get_pointer(pkChr));
- abort();
- }
- pkChr->GetDesc()->Packet(&p, sizeof(TPacketGCTarget));
- }
- }
- void CHARACTER::CheckTarget()
- {
- if (!m_pkChrTarget)
- return;
- if (DISTANCE_APPROX(GetX() - m_pkChrTarget->GetX(), GetY() - m_pkChrTarget->GetY()) >= 4800)
- SetTarget(NULL);
- }
- void CHARACTER::SetWarpLocation(long lMapIndex, long x, long y)
- {
- m_posWarp.x = x * 100;
- m_posWarp.y = y * 100;
- m_lWarpMapIndex = lMapIndex;
- }
- void CHARACTER::SaveExitLocation()
- {
- m_posExit = GetXYZ();
- m_lExitMapIndex = GetMapIndex();
- }
- void CHARACTER::ExitToSavedLocation()
- {
- sys_log (0, "ExitToSavedLocation");
- WarpSet(m_posWarp.x, m_posWarp.y, m_lWarpMapIndex);
- m_posExit.x = m_posExit.y = m_posExit.z = 0;
- m_lExitMapIndex = 0;
- }
- // fixme
- // Áö±Ý±îÁø privateMapIndex °¡ ÇöÀç ¸Ê À妽º¿Í °°ÀºÁö üũ ÇÏ´Â °ÍÀ» ¿ÜºÎ¿¡¼ ÇÏ°í,
- // ´Ù¸£¸é warpsetÀ» ºÒ·¶´Âµ¥
- // À̸¦ warpset ¾ÈÀ¸·Î ³ÖÀÚ.
- bool CHARACTER::WarpSet(long x, long y, long lPrivateMapIndex)
- {
- if (!IsPC())
- return false;
- long lAddr;
- long lMapIndex;
- WORD wPort;
- if (!CMapLocation::instance().Get(x, y, lMapIndex, lAddr, wPort))
- {
- sys_err("cannot find map location index %d x %d y %d name %s", lMapIndex, x, y, GetName());
- return false;
- }
- //Send Supplementary Data Block if new map requires security packages in loading this map
- {
- long lCurAddr;
- long lCurMapIndex = 0;
- WORD wCurPort;
- CMapLocation::instance().Get(GetX(), GetY(), lCurMapIndex, lCurAddr, wCurPort);
- //do not send SDB files if char is in the same map
- if( lCurMapIndex != lMapIndex )
- {
- const TMapRegion * rMapRgn = SECTREE_MANAGER::instance().GetMapRegion(lMapIndex);
- {
- DESC_MANAGER::instance().SendClientPackageSDBToLoadMap( GetDesc(), rMapRgn->strMapName.c_str() );
- }
- }
- }
- if (lPrivateMapIndex >= 10000)
- {
- if (lPrivateMapIndex / 10000 != lMapIndex)
- {
- sys_err("Invalid map inedx %d, must be child of %d", lPrivateMapIndex, lMapIndex);
- return false;
- }
- lMapIndex = lPrivateMapIndex;
- }
- Stop();
- Save();
- if (GetSectree())
- {
- GetSectree()->RemoveEntity(this);
- ViewCleanup();
- EncodeRemovePacket(this);
- }
- m_lWarpMapIndex = lMapIndex;
- m_posWarp.x = x;
- m_posWarp.y = y;
- sys_log(0, "WarpSet %s %d %d current map %d target map %d", GetName(), x, y, GetMapIndex(), lMapIndex);
- TPacketGCWarp p;
- p.bHeader = HEADER_GC_WARP;
- p.lX = x;
- p.lY = y;
- p.lAddr = lAddr;
- p.wPort = wPort;
- GetDesc()->Packet(&p, sizeof(TPacketGCWarp));
- //if (!LC_IsNewCIBN())
- {
- char buf[256];
- snprintf(buf, sizeof(buf), "%s MapIdx %ld DestMapIdx%ld DestX%ld DestY%ld Empire%d", GetName(), GetMapIndex(), lPrivateMapIndex, x, y, GetEmpire());
- LogManager::instance().CharLog(this, 0, "WARP", buf);
- }
- return true;
- }
- void CHARACTER::WarpEnd()
- {
- if (test_server)
- sys_log(0, "WarpEnd %s", GetName());
- if (m_posWarp.x == 0 && m_posWarp.y == 0)
- return;
- int index = m_lWarpMapIndex;
- if (index > 10000)
- index /= 10000;
- if (!map_allow_find(index))
- {
- // ÀÌ °÷À¸·Î ¿öÇÁÇÒ ¼ö ¾øÀ¸¹Ç·Î ¿öÇÁÇϱâ Àü ÁÂÇ¥·Î µÇµ¹¸®ÀÚ.
- sys_err("location %d %d not allowed to login this server", m_posWarp.x, m_posWarp.y);
- GetDesc()->SetPhase(PHASE_CLOSE);
- return;
- }
- sys_log(0, "WarpEnd %s %d %u %u", GetName(), m_lWarpMapIndex, m_posWarp.x, m_posWarp.y);
- Show(m_lWarpMapIndex, m_posWarp.x, m_posWarp.y, 0);
- Stop();
- m_lWarpMapIndex = 0;
- m_posWarp.x = m_posWarp.y = m_posWarp.z = 0;
- {
- // P2P Login
- TPacketGGLogin p;
- p.bHeader = HEADER_GG_LOGIN;
- strlcpy(p.szName, GetName(), sizeof(p.szName));
- p.dwPID = GetPlayerID();
- p.bEmpire = GetEmpire();
- p.lMapIndex = SECTREE_MANAGER::instance().GetMapIndex(GetX(), GetY());
- p.bChannel = g_bChannel;
- P2P_MANAGER::instance().Send(&p, sizeof(TPacketGGLogin));
- }
- }
- bool CHARACTER::Return()
- {
- if (!IsNPC())
- return false;
- int x, y;
- /*
- float fDist = DISTANCE_SQRT(m_pkMobData->m_posLastAttacked.x - GetX(), m_pkMobData->m_posLastAttacked.y - GetY());
- float fx, fy;
- GetDeltaByDegree(GetRotation(), fDist, &fx, &fy);
- x = GetX() + (int) fx;
- y = GetY() + (int) fy;
- */
- SetVictim(NULL);
- x = m_pkMobInst->m_posLastAttacked.x;
- y = m_pkMobInst->m_posLastAttacked.y;
- SetRotationToXY(x, y);
- if (!Goto(x, y))
- return false;
- SendMovePacket(FUNC_WAIT, 0, 0, 0, 0);
- if (test_server)
- sys_log(0, "%s %p Æ÷±âÇÏ°í µ¹¾Æ°¡ÀÚ! %d %d", GetName(), this, x, y);
- if (GetParty())
- GetParty()->SendMessage(this, PM_RETURN, x, y);
- return true;
- }
- bool CHARACTER::Follow(LPCHARACTER pkChr, float fMinDistance)
- {
- if (IsPC())
- {
- sys_err("CHARACTER::Follow : PC cannot use this method", GetName());
- return false;
- }
- // TRENT_MONSTER
- if (IS_SET(m_pointsInstant.dwAIFlag, AIFLAG_NOMOVE))
- {
- if (pkChr->IsPC()) // ÂѾư¡´Â »ó´ë°¡ PCÀÏ ¶§
- {
- // If i'm in a party. I must obey party leader's AI.
- if (!GetParty() || !GetParty()->GetLeader() || GetParty()->GetLeader() == this)
- {
- if (get_dword_time() - m_pkMobInst->m_dwLastAttackedTime >= 15000) // ¸¶Áö¸·À¸·Î °ø°Ý¹ÞÀºÁö 15ÃÊ°¡ Áö³µ°í
- {
- // ¸¶Áö¸· ¸ÂÀº °÷À¸·Î ºÎÅÍ 50¹ÌÅÍ ÀÌ»ó Â÷À̳ª¸é Æ÷±âÇÏ°í µ¹¾Æ°£´Ù.
- if (m_pkMobData->m_table.wAttackRange < DISTANCE_APPROX(pkChr->GetX() - GetX(), pkChr->GetY() - GetY()))
- if (Return())
- return true;
- }
- }
- }
- return false;
- }
- // END_OF_TRENT_MONSTER
- long x = pkChr->GetX();
- long y = pkChr->GetY();
- if (pkChr->IsPC()) // ÂѾư¡´Â »ó´ë°¡ PCÀÏ ¶§
- {
- // If i'm in a party. I must obey party leader's AI.
- if (!GetParty() || !GetParty()->GetLeader() || GetParty()->GetLeader() == this)
- {
- if (get_dword_time() - m_pkMobInst->m_dwLastAttackedTime >= 15000) // ¸¶Áö¸·À¸·Î °ø°Ý¹ÞÀºÁö 15ÃÊ°¡ Áö³µ°í
- {
- // ¸¶Áö¸· ¸ÂÀº °÷À¸·Î ºÎÅÍ 50¹ÌÅÍ ÀÌ»ó Â÷À̳ª¸é Æ÷±âÇÏ°í µ¹¾Æ°£´Ù.
- if (5000 < DISTANCE_APPROX(m_pkMobInst->m_posLastAttacked.x - GetX(), m_pkMobInst->m_posLastAttacked.y - GetY()))
- if (Return())
- return true;
- }
- }
- }
- if (IsGuardNPC())
- {
- if (5000 < DISTANCE_APPROX(m_pkMobInst->m_posLastAttacked.x - GetX(), m_pkMobInst->m_posLastAttacked.y - GetY()))
- if (Return())
- return true;
- }
- if (pkChr->IsState(pkChr->m_stateMove) &&
- GetMobBattleType() != BATTLE_TYPE_RANGE &&
- GetMobBattleType() != BATTLE_TYPE_MAGIC &&
- false == IsPet())
- {
- // ´ë»óÀÌ À̵¿ÁßÀÌ¸é ¿¹Ãø À̵¿À» ÇÑ´Ù
- // ³ª¿Í »ó´ë¹æÀÇ ¼ÓµµÂ÷¿Í °Å¸®·ÎºÎÅÍ ¸¸³¯ ½Ã°£À» ¿¹»óÇÑ ÈÄ
- // »ó´ë¹æÀÌ ±× ½Ã°£±îÁö Á÷¼±À¸·Î À̵¿ÇÑ´Ù°í °¡Á¤ÇÏ¿© °Å±â·Î À̵¿ÇÑ´Ù.
- float rot = pkChr->GetRotation();
- float rot_delta = GetDegreeDelta(rot, GetDegreeFromPositionXY(GetX(), GetY(), pkChr->GetX(), pkChr->GetY()));
- float yourSpeed = pkChr->GetMoveSpeed();
- float mySpeed = GetMoveSpeed();
- float fDist = DISTANCE_SQRT(x - GetX(), y - GetY());
- float fFollowSpeed = mySpeed - yourSpeed * cos(rot_delta * M_PI / 180);
- if (fFollowSpeed >= 0.1f)
- {
- float fMeetTime = fDist / fFollowSpeed;
- float fYourMoveEstimateX, fYourMoveEstimateY;
- if( fMeetTime * yourSpeed <= 100000.0f )
- {
- GetDeltaByDegree(pkChr->GetRotation(), fMeetTime * yourSpeed, &fYourMoveEstimateX, &fYourMoveEstimateY);
- x += (long) fYourMoveEstimateX;
- y += (long) fYourMoveEstimateY;
- float fDistNew = sqrt(((double)x - GetX())*(x-GetX())+((double)y - GetY())*(y-GetY()));
- if (fDist < fDistNew)
- {
- x = (long)(GetX() + (x - GetX()) * fDist / fDistNew);
- y = (long)(GetY() + (y - GetY()) * fDist / fDistNew);
- }
- }
- }
- }
- // °¡·Á´Â À§Ä¡¸¦ ¹Ù¶óºÁ¾ß ÇÑ´Ù.
- SetRotationToXY(x, y);
- float fDist = DISTANCE_SQRT(x - GetX(), y - GetY());
- if (fDist <= fMinDistance)
- return false;
- float fx, fy;
- if (IsChangeAttackPosition(pkChr) && GetMobRank() < MOB_RANK_BOSS)
- {
- // »ó´ë¹æ ÁÖº¯ ·£´ýÇÑ °÷À¸·Î À̵¿
- SetChangeAttackPositionTime();
- int retry = 16;
- int dx, dy;
- int rot = (int) GetDegreeFromPositionXY(x, y, GetX(), GetY());
- while (--retry)
- {
- if (fDist < 500.0f)
- GetDeltaByDegree((rot + number(-90, 90) + number(-90, 90)) % 360, fMinDistance, &fx, &fy);
- else
- GetDeltaByDegree(number(0, 359), fMinDistance, &fx, &fy);
- dx = x + (int) fx;
- dy = y + (int) fy;
- LPSECTREE tree = SECTREE_MANAGER::instance().Get(GetMapIndex(), dx, dy);
- if (NULL == tree)
- break;
- if (0 == (tree->GetAttribute(dx, dy) & (ATTR_BLOCK | ATTR_OBJECT)))
- break;
- }
- //sys_log(0, "±Ùó ¾îµò°¡·Î À̵¿ %s retry %d", GetName(), retry);
- if (!Goto(dx, dy))
- return false;
- }
- else
- {
- // Á÷¼± µû¶ó°¡±â
- float fDistToGo = fDist - fMinDistance;
- GetDeltaByDegree(GetRotation(), fDistToGo, &fx, &fy);
- //sys_log(0, "Á÷¼±À¸·Î À̵¿ %s", GetName());
- if (!Goto(GetX() + (int) fx, GetY() + (int) fy))
- return false;
- }
- SendMovePacket(FUNC_WAIT, 0, 0, 0, 0);
- //MonsterLog("ÂѾư¡±â; %s", pkChr->GetName());
- return true;
- }
- float CHARACTER::GetDistanceFromSafeboxOpen() const
- {
- return DISTANCE_APPROX(GetX() - m_posSafeboxOpen.x, GetY() - m_posSafeboxOpen.y);
- }
- void CHARACTER::SetSafeboxOpenPosition()
- {
- m_posSafeboxOpen = GetXYZ();
- }
- CSafebox * CHARACTER::GetSafebox() const
- {
- return m_pkSafebox;
- }
- void CHARACTER::ReqSafeboxLoad(const char* pszPassword)
- {
- if (!*pszPassword || strlen(pszPassword) > SAFEBOX_PASSWORD_MAX_LEN)
- {
- ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<â°í> À߸øµÈ ¾ÏÈ£¸¦ ÀÔ·ÂÇϼ̽À´Ï´Ù."));
- return;
- }
- else if (m_pkSafebox)
- {
- ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<â°í> â°í°¡ ÀÌ¹Ì ¿·ÁÀÖ½À´Ï´Ù."));
- return;
- }
- int iPulse = thecore_pulse();
- if (iPulse - GetSafeboxLoadTime() < PASSES_PER_SEC(10))
- {
- ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<â°í> â°í¸¦ ´ÝÀºÁö 10ÃÊ ¾È¿¡´Â ¿ ¼ö ¾ø½À´Ï´Ù."));
- return;
- }
- else if (GetDistanceFromSafeboxOpen() > 1000)
- {
- ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<â°í> °Å¸®°¡ ¸Ö¾î¼ â°í¸¦ ¿ ¼ö ¾ø½À´Ï´Ù."));
- return;
- }
- else if (m_bOpeningSafebox)
- {
- sys_log(0, "Overlapped safebox load request from %s", GetName());
- return;
- }
- SetSafeboxLoadTime();
- m_bOpeningSafebox = true;
- TSafeboxLoadPacket p;
- p.dwID = GetDesc()->GetAccountTable().id;
- strlcpy(p.szLogin, GetDesc()->GetAccountTable().login, sizeof(p.szLogin));
- strlcpy(p.szPassword, pszPassword, sizeof(p.szPassword));
- db_clientdesc->DBPacket(HEADER_GD_SAFEBOX_LOAD, GetDesc()->GetHandle(), &p, sizeof(p));
- }
- void CHARACTER::LoadSafebox(int iSize, DWORD dwGold, int iItemCount, TPlayerItem * pItems)
- {
- bool bLoaded = false;
- //PREVENT_TRADE_WINDOW
- SetOpenSafebox(true);
- //END_PREVENT_TRADE_WINDOW
- if (m_pkSafebox)
- bLoaded = true;
- if (!m_pkSafebox)
- m_pkSafebox = M2_NEW CSafebox(this, iSize, dwGold);
- else
- m_pkSafebox->ChangeSize(iSize);
- m_iSafeboxSize = iSize;
- TPacketCGSafeboxSize p;
- p.bHeader = HEADER_GC_SAFEBOX_SIZE;
- p.bSize = iSize;
- GetDesc()->Packet(&p, sizeof(TPacketCGSafeboxSize));
- if (!bLoaded)
- {
- for (int i = 0; i < iItemCount; ++i, ++pItems)
- {
- if (!m_pkSafebox->IsValidPosition(pItems->pos))
- continue;
- #ifdef __CHANGE_LOOK_SYSTEM__
- LPITEM item = ITEM_MANAGER::instance().CreateItem(pItems->vnum, pItems->count, pItems->id, false, -1, false, pItems->dwVnum);
- #else
- LPITEM item = ITEM_MANAGER::instance().CreateItem(pItems->vnum, pItems->count, pItems->id);
- #endif
- if (!item)
- {
- sys_err("cannot create item vnum %d id %u (name: %s)", pItems->vnum, pItems->id, GetName());
- continue;
- }
- item->SetSkipSave(true);
- item->SetSockets(pItems->alSockets);
- item->SetAttributes(pItems->aAttr);
- if (!m_pkSafebox->Add(pItems->pos, item))
- {
- M2_DESTROY_ITEM(item);
- }
- else
- item->SetSkipSave(false);
- }
- }
- }
- void CHARACTER::ChangeSafeboxSize(BYTE bSize)
- {
- //if (!m_pkSafebox)
- //return;
- TPacketCGSafeboxSize p;
- p.bHeader = HEADER_GC_SAFEBOX_SIZE;
- p.bSize = bSize;
- GetDesc()->Packet(&p, sizeof(TPacketCGSafeboxSize));
- if (m_pkSafebox)
- m_pkSafebox->ChangeSize(bSize);
- m_iSafeboxSize = bSize;
- }
- void CHARACTER::CloseSafebox()
- {
- if (!m_pkSafebox)
- return;
- //PREVENT_TRADE_WINDOW
- SetOpenSafebox(false);
- //END_PREVENT_TRADE_WINDOW
- m_pkSafebox->Save();
- M2_DELETE(m_pkSafebox);
- m_pkSafebox = NULL;
- ChatPacket(CHAT_TYPE_COMMAND, "CloseSafebox");
- SetSafeboxLoadTime();
- m_bOpeningSafebox = false;
- Save();
- }
- CSafebox * CHARACTER::GetMall() const
- {
- return m_pkMall;
- }
- void CHARACTER::LoadMall(int iItemCount, TPlayerItem * pItems)
- {
- bool bLoaded = false;
- if (m_pkMall)
- bLoaded = true;
- if (!m_pkMall)
- m_pkMall = M2_NEW CSafebox(this, 3 * SAFEBOX_PAGE_SIZE, 0);
- else
- m_pkMall->ChangeSize(3 * SAFEBOX_PAGE_SIZE);
- m_pkMall->SetWindowMode(MALL);
- TPacketCGSafeboxSize p;
- p.bHeader = HEADER_GC_MALL_OPEN;
- p.bSize = 3 * SAFEBOX_PAGE_SIZE;
- GetDesc()->Packet(&p, sizeof(TPacketCGSafeboxSize));
- if (!bLoaded)
- {
- for (int i = 0; i < iItemCount; ++i, ++pItems)
- {
- if (!m_pkMall->IsValidPosition(pItems->pos))
- continue;
- #ifdef __CHANGE_LOOK_SYSTEM__
- LPITEM item = ITEM_MANAGER::instance().CreateItem(pItems->vnum, pItems->count, pItems->id, false, -1, false, pItems->dwVnum);
- #else
- LPITEM item = ITEM_MANAGER::instance().CreateItem(pItems->vnum, pItems->count, pItems->id);
- #endif
- if (!item)
- {
- sys_err("cannot create item vnum %d id %u (name: %s)", pItems->vnum, pItems->id, GetName());
- continue;
- }
- item->SetSkipSave(true);
- item->SetSockets(pItems->alSockets);
- item->SetAttributes(pItems->aAttr);
- if (!m_pkMall->Add(pItems->pos, item))
- M2_DESTROY_ITEM(item);
- else
- item->SetSkipSave(false);
- }
- }
- }
- void CHARACTER::CloseMall()
- {
- if (!m_pkMall)
- return;
- m_pkMall->Save();
- M2_DELETE(m_pkMall);
- m_pkMall = NULL;
- ChatPacket(CHAT_TYPE_COMMAND, "CloseMall");
- }
- bool CHARACTER::BuildUpdatePartyPacket(TPacketGCPartyUpdate & out)
- {
- if (!GetParty())
- return false;
- memset(&out, 0, sizeof(out));
- out.header = HEADER_GC_PARTY_UPDATE;
- out.pid = GetPlayerID();
- out.percent_hp = MINMAX(0, GetHP() * 100 / GetMaxHP(), 100);
- out.role = GetParty()->GetRole(GetPlayerID());
- sys_log(1, "PARTY %s role is %d", GetName(), out.role);
- LPCHARACTER l = GetParty()->GetLeaderCharacter();
- if (l && DISTANCE_APPROX(GetX() - l->GetX(), GetY() - l->GetY()) < PARTY_DEFAULT_RANGE)
- {
- if (g_iUseLocale)
- out.affects[0] = GetParty()->GetPartyBonusExpPercent();
- else
- out.affects[0] = GetParty()->GetExpBonusPercent();
- out.affects[1] = GetPoint(POINT_PARTY_ATTACKER_BONUS);
- out.affects[2] = GetPoint(POINT_PARTY_TANKER_BONUS);
- out.affects[3] = GetPoint(POINT_PARTY_BUFFER_BONUS);
- out.affects[4] = GetPoint(POINT_PARTY_SKILL_MASTER_BONUS);
- out.affects[5] = GetPoint(POINT_PARTY_HASTE_BONUS);
- out.affects[6] = GetPoint(POINT_PARTY_DEFENDER_BONUS);
- }
- return true;
- }
- int CHARACTER::GetLeadershipSkillLevel() const
- {
- return GetSkillLevel(SKILL_LEADERSHIP);
- }
- void CHARACTER::QuerySafeboxSize()
- {
- if (m_iSafeboxSize == -1)
- {
- DBManager::instance().ReturnQuery(QID_SAFEBOX_SIZE,
- GetPlayerID(),
- NULL,
- "SELECT size FROM safebox%s WHERE account_id = %u",
- get_table_postfix(),
- GetDesc()->GetAccountTable().id);
- }
- }
- void CHARACTER::SetSafeboxSize(int iSize)
- {
- sys_log(1, "SetSafeboxSize: %s %d", GetName(), iSize);
- m_iSafeboxSize = iSize;
- DBManager::instance().Query("UPDATE safebox%s SET size = %d WHERE account_id = %u", get_table_postfix(), iSize / SAFEBOX_PAGE_SIZE, GetDesc()->GetAccountTable().id);
- }
- int CHARACTER::GetSafeboxSize() const
- {
- return m_iSafeboxSize;
- }
- void CHARACTER::SetNowWalking(bool bWalkFlag)
- {
- //if (m_bNowWalking != bWalkFlag || IsNPC())
- if (m_bNowWalking != bWalkFlag)
- {
- if (bWalkFlag)
- {
- m_bNowWalking = true;
- m_dwWalkStartTime = get_dword_time();
- }
- else
- {
- m_bNowWalking = false;
- }
- //if (m_bNowWalking)
- {
- TPacketGCWalkMode p;
- p.vid = GetVID();
- p.header = HEADER_GC_WALK_MODE;
- p.mode = m_bNowWalking ? WALKMODE_WALK : WALKMODE_RUN;
- PacketView(&p, sizeof(p));
- }
- if (IsNPC())
- {
- if (m_bNowWalking)
- MonsterLog("°È´Â´Ù");
- else
- MonsterLog("¶Ú´Ù");
- }
- //sys_log(0, "%s is now %s", GetName(), m_bNowWalking?"walking.":"running.");
- }
- }
- void CHARACTER::StartStaminaConsume()
- {
- if (m_bStaminaConsume)
- return;
- PointChange(POINT_STAMINA, 0);
- m_bStaminaConsume = true;
- //ChatPacket(CHAT_TYPE_COMMAND, "StartStaminaConsume %d %d", STAMINA_PER_STEP * passes_per_sec, GetStamina());
- if (IsStaminaHalfConsume())
- ChatPacket(CHAT_TYPE_COMMAND, "StartStaminaConsume %d %d", STAMINA_PER_STEP * passes_per_sec / 2, GetStamina());
- else
- ChatPacket(CHAT_TYPE_COMMAND, "StartStaminaConsume %d %d", STAMINA_PER_STEP * passes_per_sec, GetStamina());
- }
- void CHARACTER::StopStaminaConsume()
- {
- if (!m_bStaminaConsume)
- return;
- PointChange(POINT_STAMINA, 0);
- m_bStaminaConsume = false;
- ChatPacket(CHAT_TYPE_COMMAND, "StopStaminaConsume %d", GetStamina());
- }
- bool CHARACTER::IsStaminaConsume() const
- {
- return m_bStaminaConsume;
- }
- bool CHARACTER::IsStaminaHalfConsume() const
- {
- return IsEquipUniqueItem(UNIQUE_ITEM_HALF_STAMINA);
- }
- void CHARACTER::ResetStopTime()
- {
- m_dwStopTime = get_dword_time();
- }
- DWORD CHARACTER::GetStopTime() const
- {
- return m_dwStopTime;
- }
- void CHARACTER::ResetPoint(int iLv)
- {
- BYTE bJob = GetJob();
- PointChange(POINT_LEVEL, iLv - GetLevel());
- SetRealPoint(POINT_ST, JobInitialPoints[bJob].st);
- SetPoint(POINT_ST, GetRealPoint(POINT_ST));
- SetRealPoint(POINT_HT, JobInitialPoints[bJob].ht);
- SetPoint(POINT_HT, GetRealPoint(POINT_HT));
- SetRealPoint(POINT_DX, JobInitialPoints[bJob].dx);
- SetPoint(POINT_DX, GetRealPoint(POINT_DX));
- SetRealPoint(POINT_IQ, JobInitialPoints[bJob].iq);
- SetPoint(POINT_IQ, GetRealPoint(POINT_IQ));
- SetRandomHP((iLv - 1) * number(JobInitialPoints[GetJob()].hp_per_lv_begin, JobInitialPoints[GetJob()].hp_per_lv_end));
- SetRandomSP((iLv - 1) * number(JobInitialPoints[GetJob()].sp_per_lv_begin, JobInitialPoints[GetJob()].sp_per_lv_end));
- //PointChange(POINT_STAT, ((MINMAX(1, iLv, 99) - 1) * 3) + GetPoint(POINT_LEVEL_STEP) - GetPoint(POINT_STAT));
- PointChange(POINT_STAT, ((MINMAX(1, iLv, 90) - 1) * 3) + GetPoint(POINT_LEVEL_STEP) - GetPoint(POINT_STAT));
- ComputePoints();
- // ȸº¹
- PointChange(POINT_HP, GetMaxHP() - GetHP());
- PointChange(POINT_SP, GetMaxSP() - GetSP());
- PointsPacket();
- LogManager::instance().CharLog(this, 0, "RESET_POINT", "");
- }
- bool CHARACTER::IsChangeAttackPosition(LPCHARACTER target) const
- {
- if (!IsNPC())
- return true;
- DWORD dwChangeTime = AI_CHANGE_ATTACK_POISITION_TIME_NEAR;
- if (DISTANCE_APPROX(GetX() - target->GetX(), GetY() - target->GetY()) >
- AI_CHANGE_ATTACK_POISITION_DISTANCE + GetMobAttackRange())
- dwChangeTime = AI_CHANGE_ATTACK_POISITION_TIME_FAR;
- return get_dword_time() - m_dwLastChangeAttackPositionTime > dwChangeTime;
- }
- void CHARACTER::GiveRandomSkillBook()
- {
- LPITEM item = AutoGiveItem(50300);
- if (NULL != item)
- {
- BYTE bJob = 0;
- if (!number(0, 1))
- bJob = GetJob() + 1;
- DWORD dwSkillVnum = 0;
- do
- {
- dwSkillVnum = number(1, 111);
- const CSkillProto* pkSk = CSkillManager::instance().Get(dwSkillVnum);
- if (NULL == pkSk)
- continue;
- if (bJob && bJob != pkSk->dwType)
- continue;
- break;
- } while (true);
- item->SetSocket(0, dwSkillVnum);
- }
- }
- void CHARACTER::ReviveInvisible(int iDur)
- {
- AddAffect(AFFECT_REVIVE_INVISIBLE, POINT_NONE, 0, AFF_REVIVE_INVISIBLE, iDur, 0, true);
- }
- void CHARACTER::ToggleMonsterLog()
- {
- m_bMonsterLog = !m_bMonsterLog;
- if (m_bMonsterLog)
- {
- CHARACTER_MANAGER::instance().RegisterForMonsterLog(this);
- }
- else
- {
- CHARACTER_MANAGER::instance().UnregisterForMonsterLog(this);
- }
- }
- void CHARACTER::SetGuild(CGuild* pGuild)
- {
- if (m_pGuild != pGuild)
- {
- m_pGuild = pGuild;
- UpdatePacket();
- }
- }
- void CHARACTER::SendGreetMessage()
- {
- typeof(DBManager::instance().GetGreetMessage()) v = DBManager::instance().GetGreetMessage();
- for (itertype(v) it = v.begin(); it != v.end(); ++it)
- {
- ChatPacket(CHAT_TYPE_NOTICE, it->c_str());
- }
- }
- void CHARACTER::BeginStateEmpty()
- {
- MonsterLog("!");
- }
- void CHARACTER::EffectPacket(int enumEffectType)
- {
- TPacketGCSpecialEffect p;
- p.header = HEADER_GC_SEPCIAL_EFFECT;
- p.type = enumEffectType;
- p.vid = GetVID();
- PacketAround(&p, sizeof(TPacketGCSpecialEffect));
- }
- void CHARACTER::SpecificEffectPacket(const char filename[MAX_EFFECT_FILE_NAME])
- {
- TPacketGCSpecificEffect p;
- p.header = HEADER_GC_SPECIFIC_EFFECT;
- p.vid = GetVID();
- memcpy (p.effect_file, filename, MAX_EFFECT_FILE_NAME);
- PacketAround(&p, sizeof(TPacketGCSpecificEffect));
- }
- void CHARACTER::MonsterChat(BYTE bMonsterChatType)
- {
- if (IsPC())
- return;
- char sbuf[256+1];
- if (IsMonster())
- {
- if (number(0, 60))
- return;
- snprintf(sbuf, sizeof(sbuf),
- "(locale.monster_chat[%i] and locale.monster_chat[%i][%d] or '')",
- GetRaceNum(), GetRaceNum(), bMonsterChatType*3 + number(1, 3));
- }
- else
- {
- if (bMonsterChatType != MONSTER_CHAT_WAIT)
- return;
- if (IsGuardNPC())
- {
- if (number(0, 6))
- return;
- }
- else
- {
- if (number(0, 30))
- return;
- }
- snprintf(sbuf, sizeof(sbuf), "(locale.monster_chat[%i] and locale.monster_chat[%i][number(1, table.getn(locale.monster_chat[%i]))] or '')", GetRaceNum(), GetRaceNum(), GetRaceNum());
- }
- std::string text = quest::ScriptToString(sbuf);
- if (text.empty())
- return;
- struct packet_chat pack_chat;
- pack_chat.header = HEADER_GC_CHAT;
- pack_chat.size = sizeof(struct packet_chat) + text.size() + 1;
- pack_chat.type = CHAT_TYPE_TALKING;
- pack_chat.id = GetVID();
- pack_chat.bEmpire = 0;
- TEMP_BUFFER buf;
- buf.write(&pack_chat, sizeof(struct packet_chat));
- buf.write(text.c_str(), text.size() + 1);
- PacketAround(buf.read_peek(), buf.size());
- }
- void CHARACTER::SetQuestNPCID(DWORD vid)
- {
- m_dwQuestNPCVID = vid;
- }
- LPCHARACTER CHARACTER::GetQuestNPC() const
- {
- return CHARACTER_MANAGER::instance().Find(m_dwQuestNPCVID);
- }
- void CHARACTER::SetQuestItemPtr(LPITEM item)
- {
- m_pQuestItem = item;
- }
- void CHARACTER::ClearQuestItemPtr()
- {
- m_pQuestItem = NULL;
- }
- LPITEM CHARACTER::GetQuestItemPtr() const
- {
- return m_pQuestItem;
- }
- LPDUNGEON CHARACTER::GetDungeonForce() const
- {
- if (m_lWarpMapIndex > 10000)
- return CDungeonManager::instance().FindByMapIndex(m_lWarpMapIndex);
- return m_pkDungeon;
- }
- void CHARACTER::SetBlockMode(BYTE bFlag)
- {
- m_pointsInstant.bBlockMode = bFlag;
- ChatPacket(CHAT_TYPE_COMMAND, "setblockmode %d", m_pointsInstant.bBlockMode);
- SetQuestFlag("game_option.block_exchange", bFlag & BLOCK_EXCHANGE ? 1 : 0);
- SetQuestFlag("game_option.block_party_invite", bFlag & BLOCK_PARTY_INVITE ? 1 : 0);
- SetQuestFlag("game_option.block_guild_invite", bFlag & BLOCK_GUILD_INVITE ? 1 : 0);
- SetQuestFlag("game_option.block_whisper", bFlag & BLOCK_WHISPER ? 1 : 0);
- SetQuestFlag("game_option.block_messenger_invite", bFlag & BLOCK_MESSENGER_INVITE ? 1 : 0);
- SetQuestFlag("game_option.block_party_request", bFlag & BLOCK_PARTY_REQUEST ? 1 : 0);
- }
- void CHARACTER::SetBlockModeForce(BYTE bFlag)
- {
- m_pointsInstant.bBlockMode = bFlag;
- ChatPacket(CHAT_TYPE_COMMAND, "setblockmode %d", m_pointsInstant.bBlockMode);
- }
- bool CHARACTER::IsGuardNPC() const
- {
- return IsNPC() && (GetRaceNum() == 11000 || GetRaceNum() == 11002 || GetRaceNum() == 11004);
- }
- int CHARACTER::GetPolymorphPower() const
- {
- if (test_server)
- {
- int value = quest::CQuestManager::instance().GetEventFlag("poly");
- if (value)
- return value;
- }
- return aiPolymorphPowerByLevel[MINMAX(0, GetSkillLevel(SKILL_POLYMORPH), 40)];
- }
- void CHARACTER::SetPolymorph(DWORD dwRaceNum, bool bMaintainStat)
- {
- if (dwRaceNum < JOB_MAX_NUM)
- {
- dwRaceNum = 0;
- bMaintainStat = false;
- }
- if (m_dwPolymorphRace == dwRaceNum)
- return;
- m_bPolyMaintainStat = bMaintainStat;
- m_dwPolymorphRace = dwRaceNum;
- sys_log(0, "POLYMORPH: %s race %u ", GetName(), dwRaceNum);
- if (dwRaceNum != 0)
- StopRiding();
- SET_BIT(m_bAddChrState, ADD_CHARACTER_STATE_SPAWN);
- m_afAffectFlag.Set(AFF_SPAWN);
- ViewReencode();
- REMOVE_BIT(m_bAddChrState, ADD_CHARACTER_STATE_SPAWN);
- if (!bMaintainStat)
- {
- PointChange(POINT_ST, 0);
- PointChange(POINT_DX, 0);
- PointChange(POINT_IQ, 0);
- PointChange(POINT_HT, 0);
- }
- // Æú¸®¸ðÇÁ »óÅ¿¡¼ Á×´Â °æ¿ì, Æú¸®¸ðÇÁ°¡ Ç®¸®°Ô µÇ´Âµ¥
- // Æú¸® ¸ðÇÁ ÀüÈÄ·Î valid combo intervalÀÌ ´Ù¸£±â ¶§¹®¿¡
- // Combo ÇÙ ¶Ç´Â Hacker·Î ÀνÄÇÏ´Â °æ¿ì°¡ ÀÖ´Ù.
- // µû¶ó¼ Æú¸®¸ðÇÁ¸¦ Ç®°Å³ª Æú¸®¸ðÇÁ ÇÏ°Ô µÇ¸é,
- // valid combo intervalÀ» resetÇÑ´Ù.
- SetValidComboInterval(0);
- SetComboSequence(0);
- ComputeBattlePoints();
- }
- int CHARACTER::GetQuestFlag(const std::string& flag) const
- {
- quest::CQuestManager& q = quest::CQuestManager::instance();
- quest::PC* pPC = q.GetPC(GetPlayerID());
- if(!pPC) {
- sys_err("Nullpointer in CHARACTER::GetQuestFlag %lu", GetPlayerID());
- return 0;
- }
- return pPC->GetFlag(flag);
- }
- void CHARACTER::SetQuestFlag(const std::string& flag, int value)
- {
- quest::CQuestManager& q = quest::CQuestManager::instance();
- quest::PC* pPC = q.GetPC(GetPlayerID());
- if(!pPC) {
- sys_err("Nullpointer in CHARACTER::SettQuestFlag %lu", GetPlayerID());
- return;
- }
- pPC->SetFlag(flag, value);
- }
- void CHARACTER::DetermineDropMetinStone()
- {
- const int METIN_STONE_NUM = 14;
- static DWORD c_adwMetin[METIN_STONE_NUM] =
- {
- 28030,
- 28031,
- 28032,
- 28033,
- 28034,
- 28035,
- 28036,
- 28037,
- 28038,
- 28039,
- 28040,
- 28041,
- 28042,
- 28043,
- };
- DWORD stone_num = GetRaceNum();
- int idx = std::lower_bound(aStoneDrop, aStoneDrop+STONE_INFO_MAX_NUM, stone_num) - aStoneDrop;
- if (idx >= STONE_INFO_MAX_NUM || aStoneDrop[idx].dwMobVnum != stone_num)
- {
- m_dwDropMetinStone = 0;
- }
- else
- {
- const SStoneDropInfo & info = aStoneDrop[idx];
- m_bDropMetinStonePct = info.iDropPct;
- {
- m_dwDropMetinStone = c_adwMetin[number(0, METIN_STONE_NUM - 1)];
- int iGradePct = number(1, 100);
- for (int iStoneLevel = 0; iStoneLevel < STONE_LEVEL_MAX_NUM; iStoneLevel ++)
- {
- int iLevelGradePortion = info.iLevelPct[iStoneLevel];
- if (iGradePct <= iLevelGradePortion)
- {
- break;
- }
- else
- {
- iGradePct -= iLevelGradePortion;
- m_dwDropMetinStone += 100; // µ¹ +a -> +(a+1)ÀÌ µÉ¶§¸¶´Ù 100¾¿ Áõ°¡
- }
- }
- }
- }
- }
- void CHARACTER::SendEquipment(LPCHARACTER ch)
- {
- TPacketViewEquip p;
- p.header = HEADER_GC_VIEW_EQUIP;
- p.vid = GetVID();
- for (int i = 0; i<WEAR_MAX_NUM; i++)
- {
- LPITEM item = GetWear(i);
- if (item)
- {
- p.equips[i].vnum = item->GetVnum();
- p.equips[i].count = item->GetCount();
- thecore_memcpy(p.equips[i].alSockets, item->GetSockets(), sizeof(p.equips[i].alSockets));
- thecore_memcpy(p.equips[i].aAttr, item->GetAttributes(), sizeof(p.equips[i].aAttr));
- }
- else
- {
- p.equips[i].vnum = 0;
- }
- }
- ch->GetDesc()->Packet(&p, sizeof(p));
- }
- bool CHARACTER::CanSummon(int iLeaderShip)
- {
- return (iLeaderShip >= 20 || iLeaderShip >= 12 && m_dwLastDeadTime + 180 > get_dword_time());
- }
- void CHARACTER::MountVnum(DWORD vnum)
- {
- if (m_dwMountVnum == vnum)
- return;
- m_dwMountVnum = vnum;
- m_dwMountTime = get_dword_time();
- if (m_bIsObserver)
- return;
- //NOTE : MountÇÑ´Ù°í Çؼ Client SideÀÇ °´Ã¼¸¦ »èÁ¦ÇÏÁø ¾Ê´Â´Ù.
- //±×¸®°í ¼¹öSide¿¡¼ ÅÀÀ»¶§ À§Ä¡ À̵¿Àº ÇÏÁö ¾Ê´Â´Ù. ¿Ö³ÄÇϸé Client Side¿¡¼ Coliision Adjust¸¦ ÇÒ¼ö Àִµ¥
- //°´Ã¼¸¦ ¼Ò¸ê½ÃÄ×´Ù°¡ ¼¹öÀ§Ä¡·Î À̵¿½ÃÅ°¸é À̶§ collision check¸¦ ÇÏÁö´Â ¾ÊÀ¸¹Ç·Î ¹è°æ¿¡ ³¢°Å³ª ¶Õ°í ³ª°¡´Â ¹®Á¦°¡ Á¸ÀçÇÑ´Ù.
- m_posDest.x = m_posStart.x = GetX();
- m_posDest.y = m_posStart.y = GetY();
- //EncodeRemovePacket(this);
- EncodeInsertPacket(this);
- ENTITY_MAP::iterator it = m_map_view.begin();
- while (it != m_map_view.end())
- {
- LPENTITY entity = (it++)->first;
- //MountÇÑ´Ù°í Çؼ Client SideÀÇ °´Ã¼¸¦ »èÁ¦ÇÏÁø ¾Ê´Â´Ù.
- //EncodeRemovePacket(entity);
- //if (!m_bIsObserver)
- EncodeInsertPacket(entity);
- //if (!entity->IsObserverMode())
- // entity->EncodeInsertPacket(this);
- }
- SetValidComboInterval(0);
- SetComboSequence(0);
- ComputePoints();
- }
- namespace {
- class FuncCheckWarp
- {
- public:
- FuncCheckWarp(LPCHARACTER pkWarp)
- {
- m_lTargetY = 0;
- m_lTargetX = 0;
- m_lX = pkWarp->GetX();
- m_lY = pkWarp->GetY();
- m_bInvalid = false;
- m_bEmpire = pkWarp->GetEmpire();
- char szTmp[64];
- if (3 != sscanf(pkWarp->GetName(), " %s %ld %ld ", szTmp, &m_lTargetX, &m_lTargetY))
- {
- if (number(1, 100) < 5)
- sys_err("Warp NPC name wrong : vnum(%d) name(%s)", pkWarp->GetRaceNum(), pkWarp->GetName());
- m_bInvalid = true;
- return;
- }
- m_lTargetX *= 100;
- m_lTargetY *= 100;
- m_bUseWarp = true;
- if (pkWarp->IsGoto())
- {
- LPSECTREE_MAP pkSectreeMap = SECTREE_MANAGER::instance().GetMap(pkWarp->GetMapIndex());
- m_lTargetX += pkSectreeMap->m_setting.iBaseX;
- m_lTargetY += pkSectreeMap->m_setting.iBaseY;
- m_bUseWarp = false;
- }
- }
- bool Valid()
- {
- return !m_bInvalid;
- }
- void operator () (LPENTITY ent)
- {
- if (!Valid())
- return;
- if (!ent->IsType(ENTITY_CHARACTER))
- return;
- LPCHARACTER pkChr = (LPCHARACTER) ent;
- if (!pkChr->IsPC())
- return;
- int iDist = DISTANCE_APPROX(pkChr->GetX() - m_lX, pkChr->GetY() - m_lY);
- if (iDist > 300)
- return;
- if (m_bEmpire && pkChr->GetEmpire() && m_bEmpire != pkChr->GetEmpire())
- return;
- if (pkChr->IsHack())
- return;
- if (!pkChr->CanHandleItem(false, true))
- return;
- if (m_bUseWarp)
- pkChr->WarpSet(m_lTargetX, m_lTargetY);
- else
- {
- pkChr->Show(pkChr->GetMapIndex(), m_lTargetX, m_lTargetY);
- pkChr->Stop();
- }
- }
- bool m_bInvalid;
- bool m_bUseWarp;
- long m_lX;
- long m_lY;
- long m_lTargetX;
- long m_lTargetY;
- BYTE m_bEmpire;
- };
- }
- EVENTFUNC(warp_npc_event)
- {
- char_event_info* info = dynamic_cast<char_event_info*>( event->info );
- if ( info == NULL )
- {
- sys_err( "warp_npc_event> <Factor> Null pointer" );
- return 0;
- }
- LPCHARACTER ch = info->ch;
- if (ch == NULL) { // <Factor>
- return 0;
- }
- if (!ch->GetSectree())
- {
- ch->m_pkWarpNPCEvent = NULL;
- return 0;
- }
- FuncCheckWarp f(ch);
- if (f.Valid())
- ch->GetSectree()->ForEachAround(f);
- return passes_per_sec / 2;
- }
- void CHARACTER::ChannelSwitch(int new_ch){
- long lAddr;
- long lMapIndex;
- WORD wPort;
- long x = this->GetX();
- long y = this->GetY();
- if (!CMapLocation::instance().Get(x, y, lMapIndex, lAddr, wPort))
- {
- sys_err("cannot find map location index %d x %d y %d name %s", lMapIndex, x, y, GetName());
- return;
- }
- if(lMapIndex >= 10000){
- return;
- }
- std::map<WORD, int>micha;
- for(int i = 0; i < 4; i++){ //replace with maximum channels -1 actual 1300x - 1330x
- for(int i2 = 2; i2 < 9; i2++){ //replace with your core values actual 13x02 - 13x08
- micha[13*1000 + i*1000 + i2] = i+1;
- }
- }
- //micha[13090] = 1;
- int chan;
- if(micha.find(wPort) != micha.end()){
- chan = micha[wPort];
- }else{return;}
- Stop();
- Save();
- if(GetSectree()){
- GetSectree()->RemoveEntity(this);
- ViewCleanup();
- EncodeRemovePacket(this);
- }
- TPacketGCWarp p;
- p.bHeader = HEADER_GC_WARP;
- p.lX = x;
- p.lY = y;
- p.lAddr = lAddr;
- p.wPort = (wPort - 1000*(chan-1) + 1000*(new_ch-1));
- sys_err("x : %d y: %d, addr: %d, port: %d , newPort: %d", x, y, lAddr, wPort, (wPort - 1000*chan + 1000*new_ch));
- GetDesc()->Packet(&p, sizeof(TPacketGCWarp));
- }
- void CHARACTER::StartWarpNPCEvent()
- {
- if (m_pkWarpNPCEvent)
- return;
- if (!IsWarp() && !IsGoto())
- return;
- char_event_info* info = AllocEventInfo<char_event_info>();
- info->ch = this;
- m_pkWarpNPCEvent = event_create(warp_npc_event, info, passes_per_sec / 2);
- }
- void CHARACTER::SyncPacket()
- {
- TEMP_BUFFER buf;
- TPacketCGSyncPositionElement elem;
- elem.dwVID = GetVID();
- elem.lX = GetX();
- elem.lY = GetY();
- TPacketGCSyncPosition pack;
- pack.bHeader = HEADER_GC_SYNC_POSITION;
- pack.wSize = sizeof(TPacketGCSyncPosition) + sizeof(elem);
- buf.write(&pack, sizeof(pack));
- buf.write(&elem, sizeof(elem));
- PacketAround(buf.read_peek(), buf.size());
- }
- LPCHARACTER CHARACTER::GetMarryPartner() const
- {
- return m_pkChrMarried;
- }
- void CHARACTER::SetMarryPartner(LPCHARACTER ch)
- {
- m_pkChrMarried = ch;
- }
- int CHARACTER::GetMarriageBonus(DWORD dwItemVnum, bool bSum)
- {
- if (IsNPC())
- return 0;
- marriage::TMarriage* pMarriage = marriage::CManager::instance().Get(GetPlayerID());
- if (!pMarriage)
- return 0;
- return pMarriage->GetBonus(dwItemVnum, bSum, this);
- }
- void CHARACTER::ConfirmWithMsg(const char* szMsg, int iTimeout, DWORD dwRequestPID)
- {
- if (!IsPC())
- return;
- TPacketGCQuestConfirm p;
- p.header = HEADER_GC_QUEST_CONFIRM;
- p.requestPID = dwRequestPID;
- p.timeout = iTimeout;
- strlcpy(p.msg, szMsg, sizeof(p.msg));
- GetDesc()->Packet(&p, sizeof(p));
- }
- int CHARACTER::GetPremiumRemainSeconds(BYTE bType) const
- {
- if (bType >= PREMIUM_MAX_NUM)
- return 0;
- return m_aiPremiumTimes[bType] - get_global_time();
- }
- bool CHARACTER::WarpToPID(DWORD dwPID)
- {
- LPCHARACTER victim;
- if ((victim = (CHARACTER_MANAGER::instance().FindByPID(dwPID))))
- {
- int mapIdx = victim->GetMapIndex();
- if (IS_SUMMONABLE_ZONE(mapIdx))
- {
- if (CAN_ENTER_ZONE(this, mapIdx))
- {
- WarpSet(victim->GetX(), victim->GetY());
- }
- else
- {
- ChatPacket(CHAT_TYPE_INFO, LC_TEXT("»ó´ë¹æÀÌ ÀÖ´Â °÷À¸·Î ¿öÇÁÇÒ ¼ö ¾ø½À´Ï´Ù."));
- return false;
- }
- }
- else
- {
- ChatPacket(CHAT_TYPE_INFO, LC_TEXT("»ó´ë¹æÀÌ ÀÖ´Â °÷À¸·Î ¿öÇÁÇÒ ¼ö ¾ø½À´Ï´Ù."));
- return false;
- }
- }
- else
- {
- // ´Ù¸¥ ¼¹ö¿¡ ·Î±×ÀÎµÈ »ç¶÷ÀÌ ÀÖÀ½ -> ¸Þ½ÃÁö º¸³» ÁÂÇ¥¸¦ ¹Þ¾Æ¿ÀÀÚ
- // 1. A.pid, B.pid ¸¦ »Ñ¸²
- // 2. B.pid¸¦ °¡Áø ¼¹ö°¡ »Ñ¸°¼¹ö¿¡°Ô A.pid, ÁÂÇ¥ ¸¦ º¸³¿
- // 3. ¿öÇÁ
- CCI * pcci = P2P_MANAGER::instance().FindByPID(dwPID);
- if (!pcci)
- {
- ChatPacket(CHAT_TYPE_INFO, LC_TEXT("»ó´ë¹æÀÌ ¿Â¶óÀÎ »óÅ°¡ ¾Æ´Õ´Ï´Ù."));
- return false;
- }
- if (pcci->bChannel != g_bChannel)
- {
- ChatPacket(CHAT_TYPE_INFO, LC_TEXT("»ó´ë¹æÀÌ %d ä³Î¿¡ ÀÖ½À´Ï´Ù. (ÇöÀç ä³Î %d)"), pcci->bChannel, g_bChannel);
- return false;
- }
- else if (false == IS_SUMMONABLE_ZONE(pcci->lMapIndex))
- {
- ChatPacket(CHAT_TYPE_INFO, LC_TEXT("»ó´ë¹æÀÌ ÀÖ´Â °÷À¸·Î ¿öÇÁÇÒ ¼ö ¾ø½À´Ï´Ù."));
- return false;
- }
- else
- {
- if (!CAN_ENTER_ZONE(this, pcci->lMapIndex))
- {
- ChatPacket(CHAT_TYPE_INFO, LC_TEXT("»ó´ë¹æÀÌ ÀÖ´Â °÷À¸·Î ¿öÇÁÇÒ ¼ö ¾ø½À´Ï´Ù."));
- return false;
- }
- TPacketGGFindPosition p;
- p.header = HEADER_GG_FIND_POSITION;
- p.dwFromPID = GetPlayerID();
- p.dwTargetPID = dwPID;
- pcci->pkDesc->Packet(&p, sizeof(TPacketGGFindPosition));
- if (test_server)
- ChatPacket(CHAT_TYPE_PARTY, "sent find position packet for teleport");
- }
- }
- return true;
- }
- // ADD_REFINE_BUILDING
- CGuild* CHARACTER::GetRefineGuild() const
- {
- LPCHARACTER chRefineNPC = CHARACTER_MANAGER::instance().Find(m_dwRefineNPCVID);
- return (chRefineNPC ? chRefineNPC->GetGuild() : NULL);
- }
- bool CHARACTER::IsRefineThroughGuild() const
- {
- return GetRefineGuild() != NULL;
- }
- int CHARACTER::ComputeRefineFee(int iCost, int iMultiply) const
- {
- CGuild* pGuild = GetRefineGuild();
- if (pGuild)
- {
- if (pGuild == GetGuild())
- return iCost * iMultiply * 9 / 10;
- // ´Ù¸¥ Á¦±¹ »ç¶÷ÀÌ ½ÃµµÇÏ´Â °æ¿ì Ãß°¡·Î 3¹è ´õ
- LPCHARACTER chRefineNPC = CHARACTER_MANAGER::instance().Find(m_dwRefineNPCVID);
- if (chRefineNPC && chRefineNPC->GetEmpire() != GetEmpire())
- return iCost * iMultiply * 3;
- return iCost * iMultiply;
- }
- else
- return iCost;
- }
- void CHARACTER::PayRefineFee(int iTotalMoney)
- {
- int iFee = iTotalMoney / 10;
- CGuild* pGuild = GetRefineGuild();
- int iRemain = iTotalMoney;
- if (pGuild)
- {
- // Àڱ⠱æµåÀ̸é iTotalMoney¿¡ ÀÌ¹Ì 10%°¡ Á¦¿ÜµÇ¾îÀÖ´Ù
- if (pGuild != GetGuild())
- {
- pGuild->RequestDepositMoney(this, iFee);
- iRemain -= iFee;
- }
- }
- PointChange(POINT_GOLD, -iRemain);
- }
- // END_OF_ADD_REFINE_BUILDING
- //Hack ¹æÁö¸¦ À§ÇÑ Ã¼Å©.
- bool CHARACTER::IsHack(bool bSendMsg, bool bCheckShopOwner, int limittime)
- {
- const int iPulse = thecore_pulse();
- if (test_server)
- bSendMsg = true;
- //â°í ¿¬ÈÄ Ã¼Å©
- if (iPulse - GetSafeboxLoadTime() < PASSES_PER_SEC(limittime))
- {
- if (bSendMsg)
- ChatPacket(CHAT_TYPE_INFO, LC_TEXT("â°í¸¦ ¿¬ÈÄ %dÃÊ À̳»¿¡´Â ´Ù¸¥°÷À¸·Î À̵¿ÇÒ¼ö ¾ø½À´Ï´Ù."), limittime);
- if (test_server)
- ChatPacket(CHAT_TYPE_INFO, "[TestOnly]Pulse %d LoadTime %d PASS %d", iPulse, GetSafeboxLoadTime(), PASSES_PER_SEC(limittime));
- return true;
- }
- //°Å·¡°ü·Ã â üũ
- if (bCheckShopOwner)
- {
- if (GetExchange() || GetMyShop() || GetShopOwner() || IsOpenSafebox() || IsCubeOpen())
- {
- if (bSendMsg)
- ChatPacket(CHAT_TYPE_INFO, LC_TEXT("°Å·¡Ã¢,â°í µîÀ» ¿¬ »óÅ¿¡¼´Â ´Ù¸¥°÷À¸·Î À̵¿,Á¾·á ÇÒ¼ö ¾ø½À´Ï´Ù"));
- return true;
- }
- }
- else
- {
- if (GetExchange() || GetMyShop() || IsOpenSafebox() || IsCubeOpen())
- {
- if (bSendMsg)
- ChatPacket(CHAT_TYPE_INFO, LC_TEXT("°Å·¡Ã¢,â°í µîÀ» ¿¬ »óÅ¿¡¼´Â ´Ù¸¥°÷À¸·Î À̵¿,Á¾·á ÇÒ¼ö ¾ø½À´Ï´Ù"));
- return true;
- }
- }
- //PREVENT_PORTAL_AFTER_EXCHANGE
- //±³È¯ ÈÄ ½Ã°£Ã¼Å©
- if (iPulse - GetExchangeTime() < PASSES_PER_SEC(limittime))
- {
- if (bSendMsg)
- ChatPacket(CHAT_TYPE_INFO, LC_TEXT("°Å·¡ ÈÄ %dÃÊ À̳»¿¡´Â ´Ù¸¥Áö¿ªÀ¸·Î À̵¿ ÇÒ ¼ö ¾ø½À´Ï´Ù."), limittime );
- return true;
- }
- //END_PREVENT_PORTAL_AFTER_EXCHANGE
- //PREVENT_ITEM_COPY
- if (iPulse - GetMyShopTime() < PASSES_PER_SEC(limittime))
- {
- if (bSendMsg)
- ChatPacket(CHAT_TYPE_INFO, LC_TEXT("°Å·¡ ÈÄ %dÃÊ À̳»¿¡´Â ´Ù¸¥Áö¿ªÀ¸·Î À̵¿ ÇÒ ¼ö ¾ø½À´Ï´Ù."), limittime);
- return true;
- }
- if (iPulse - GetRefineTime() < PASSES_PER_SEC(limittime))
- {
- if (bSendMsg)
- ChatPacket(CHAT_TYPE_INFO, LC_TEXT("¾ÆÀÌÅÛ °³·®ÈÄ %dÃÊ À̳»¿¡´Â ±ÍȯºÎ,±Íȯ±â¾ïºÎ¸¦ »ç¿ëÇÒ ¼ö ¾ø½À´Ï´Ù."), limittime);
- return true;
- }
- //END_PREVENT_ITEM_COPY
- return false;
- }
- BOOL CHARACTER::IsMonarch() const
- {
- //MONARCH_LIMIT
- if (CMonarch::instance().IsMonarch(GetPlayerID(), GetEmpire()))
- return true;
- return false;
- //END_MONARCH_LIMIT
- }
- void CHARACTER::Say(const std::string & s)
- {
- struct ::packet_script packet_script;
- packet_script.header = HEADER_GC_SCRIPT;
- packet_script.skin = 1;
- packet_script.src_size = s.size();
- packet_script.size = packet_script.src_size + sizeof(struct packet_script);
- TEMP_BUFFER buf;
- buf.write(&packet_script, sizeof(struct packet_script));
- buf.write(&s[0], s.size());
- if (IsPC())
- {
- GetDesc()->Packet(buf.read_peek(), buf.size());
- }
- }
- //
- // Monarch
- //
- void CHARACTER::InitMC()
- {
- for (int n = 0; n < MI_MAX; ++n)
- {
- m_dwMonarchCooltime[n] = thecore_pulse();
- }
- m_dwMonarchCooltimelimit[MI_HEAL] = PASSES_PER_SEC(MC_HEAL);
- m_dwMonarchCooltimelimit[MI_WARP] = PASSES_PER_SEC(MC_WARP);
- m_dwMonarchCooltimelimit[MI_TRANSFER] = PASSES_PER_SEC(MC_TRANSFER);
- m_dwMonarchCooltimelimit[MI_TAX] = PASSES_PER_SEC(MC_TAX);
- m_dwMonarchCooltimelimit[MI_SUMMON] = PASSES_PER_SEC(MC_SUMMON);
- m_dwMonarchCooltime[MI_HEAL] -= PASSES_PER_SEC(GetMCL(MI_HEAL));
- m_dwMonarchCooltime[MI_WARP] -= PASSES_PER_SEC(GetMCL(MI_WARP));
- m_dwMonarchCooltime[MI_TRANSFER] -= PASSES_PER_SEC(GetMCL(MI_TRANSFER));
- m_dwMonarchCooltime[MI_TAX] -= PASSES_PER_SEC(GetMCL(MI_TAX));
- m_dwMonarchCooltime[MI_SUMMON] -= PASSES_PER_SEC(GetMCL(MI_SUMMON));
- }
- DWORD CHARACTER::GetMC(enum MONARCH_INDEX e) const
- {
- return m_dwMonarchCooltime[e];
- }
- void CHARACTER::SetMC(enum MONARCH_INDEX e)
- {
- m_dwMonarchCooltime[e] = thecore_pulse();
- }
- bool CHARACTER::IsMCOK(enum MONARCH_INDEX e) const
- {
- int iPulse = thecore_pulse();
- if ((iPulse - GetMC(e)) < GetMCL(e))
- {
- if (test_server)
- sys_log(0, " Pulse %d cooltime %d, limit %d", iPulse, GetMC(e), GetMCL(e));
- return false;
- }
- if (test_server)
- sys_log(0, " Pulse %d cooltime %d, limit %d", iPulse, GetMC(e), GetMCL(e));
- return true;
- }
- DWORD CHARACTER::GetMCL(enum MONARCH_INDEX e) const
- {
- return m_dwMonarchCooltimelimit[e];
- }
- DWORD CHARACTER::GetMCLTime(enum MONARCH_INDEX e) const
- {
- int iPulse = thecore_pulse();
- if (test_server)
- sys_log(0, " Pulse %d cooltime %d, limit %d", iPulse, GetMC(e), GetMCL(e));
- return (GetMCL(e)) / passes_per_sec - (iPulse - GetMC(e)) / passes_per_sec;
- }
- bool CHARACTER::IsSiegeNPC() const
- {
- return IsNPC() && (GetRaceNum() == 11000 || GetRaceNum() == 11002 || GetRaceNum() == 11004);
- }
- //------------------------------------------------
- void CHARACTER::UpdateDepositPulse()
- {
- m_deposit_pulse = thecore_pulse() + PASSES_PER_SEC(60*5); // 5ºÐ
- }
- bool CHARACTER::CanDeposit() const
- {
- return (m_deposit_pulse == 0 || (m_deposit_pulse < thecore_pulse()));
- }
- //------------------------------------------------
- ESex GET_SEX(LPCHARACTER ch)
- {
- switch (ch->GetRaceNum())
- {
- case MAIN_RACE_WARRIOR_M:
- case MAIN_RACE_SURA_M:
- case MAIN_RACE_ASSASSIN_M:
- case MAIN_RACE_SHAMAN_M:
- return SEX_MALE;
- case MAIN_RACE_ASSASSIN_W:
- case MAIN_RACE_SHAMAN_W:
- case MAIN_RACE_WARRIOR_W:
- case MAIN_RACE_SURA_W:
- return SEX_FEMALE;
- }
- /* default sex = male */
- return SEX_MALE;
- }
- int CHARACTER::GetHPPct() const
- {
- return (GetHP() * 100) / GetMaxHP();
- }
- bool CHARACTER::IsBerserk() const
- {
- if (m_pkMobInst != NULL)
- return m_pkMobInst->m_IsBerserk;
- else
- return false;
- }
- void CHARACTER::SetBerserk(bool mode)
- {
- if (m_pkMobInst != NULL)
- m_pkMobInst->m_IsBerserk = mode;
- }
- bool CHARACTER::IsGodSpeed() const
- {
- if (m_pkMobInst != NULL)
- {
- return m_pkMobInst->m_IsGodSpeed;
- }
- else
- {
- return false;
- }
- }
- void CHARACTER::SetGodSpeed(bool mode)
- {
- if (m_pkMobInst != NULL)
- {
- m_pkMobInst->m_IsGodSpeed = mode;
- if (mode == true)
- {
- SetPoint(POINT_ATT_SPEED, 250);
- }
- else
- {
- SetPoint(POINT_ATT_SPEED, m_pkMobData->m_table.sAttackSpeed);
- }
- }
- }
- bool CHARACTER::IsDeathBlow() const
- {
- if (number(1, 100) <= m_pkMobData->m_table.bDeathBlowPoint)
- {
- return true;
- }
- else
- {
- return false;
- }
- }
- struct FFindReviver
- {
- FFindReviver()
- {
- pChar = NULL;
- HasReviver = false;
- }
- void operator() (LPCHARACTER ch)
- {
- if (ch->IsMonster() != true)
- {
- return;
- }
- if (ch->IsReviver() == true && pChar != ch && ch->IsDead() != true)
- {
- if (number(1, 100) <= ch->GetMobTable().bRevivePoint)
- {
- HasReviver = true;
- pChar = ch;
- }
- }
- }
- LPCHARACTER pChar;
- bool HasReviver;
- };
- bool CHARACTER::HasReviverInParty() const
- {
- LPPARTY party = GetParty();
- if (party != NULL)
- {
- if (party->GetMemberCount() == 1) return false;
- FFindReviver f;
- party->ForEachMemberPtr(f);
- return f.HasReviver;
- }
- return false;
- }
- bool CHARACTER::IsRevive() const
- {
- if (m_pkMobInst != NULL)
- {
- return m_pkMobInst->m_IsRevive;
- }
- return false;
- }
- void CHARACTER::SetRevive(bool mode)
- {
- if (m_pkMobInst != NULL)
- {
- m_pkMobInst->m_IsRevive = mode;
- }
- }
- #define IS_SPEED_HACK_PLAYER(ch) (ch->m_speed_hack_count > SPEEDHACK_LIMIT_COUNT)
- EVENTFUNC(check_speedhack_event)
- {
- char_event_info* info = dynamic_cast<char_event_info*>( event->info );
- if ( info == NULL )
- {
- sys_err( "check_speedhack_event> <Factor> Null pointer" );
- return 0;
- }
- LPCHARACTER ch = info->ch;
- if (NULL == ch || ch->IsNPC())
- return 0;
- if (IS_SPEED_HACK_PLAYER(ch))
- {
- // write hack log
- LogManager::instance().SpeedHackLog(ch->GetPlayerID(), ch->GetX(), ch->GetY(), ch->m_speed_hack_count);
- if (false == LC_IsEurope())
- {
- // close connection
- LPDESC desc = ch->GetDesc();
- if (desc)
- {
- DESC_MANAGER::instance().DestroyDesc(desc);
- return 0;
- }
- }
- }
- ch->m_speed_hack_count = 0;
- ch->ResetComboHackCount();
- return PASSES_PER_SEC(60);
- }
- void CHARACTER::StartCheckSpeedHackEvent()
- {
- if (m_pkCheckSpeedHackEvent)
- return;
- char_event_info* info = AllocEventInfo<char_event_info>();
- info->ch = this;
- m_pkCheckSpeedHackEvent = event_create(check_speedhack_event, info, PASSES_PER_SEC(60)); // 1ºÐ
- }
- void CHARACTER::GoHome()
- {
- WarpSet(EMPIRE_START_X(GetEmpire()), EMPIRE_START_Y(GetEmpire()));
- }
- void CHARACTER::SendGuildName(CGuild* pGuild)
- {
- if (NULL == pGuild) return;
- DESC *desc = GetDesc();
- if (NULL == desc) return;
- if (m_known_guild.find(pGuild->GetID()) != m_known_guild.end()) return;
- m_known_guild.insert(pGuild->GetID());
- TPacketGCGuildName pack;
- memset(&pack, 0x00, sizeof(pack));
- pack.header = HEADER_GC_GUILD;
- pack.subheader = GUILD_SUBHEADER_GC_GUILD_NAME;
- pack.size = sizeof(TPacketGCGuildName);
- pack.guildID = pGuild->GetID();
- memcpy(pack.guildName, pGuild->GetName(), GUILD_NAME_MAX_LEN);
- desc->Packet(&pack, sizeof(pack));
- }
- void CHARACTER::SendGuildName(DWORD dwGuildID)
- {
- SendGuildName(CGuildManager::instance().FindGuild(dwGuildID));
- }
- EVENTFUNC(destroy_when_idle_event)
- {
- char_event_info* info = dynamic_cast<char_event_info*>( event->info );
- if ( info == NULL )
- {
- sys_err( "destroy_when_idle_event> <Factor> Null pointer" );
- return 0;
- }
- LPCHARACTER ch = info->ch;
- if (ch == NULL) { // <Factor>
- return 0;
- }
- if (ch->GetVictim())
- {
- return PASSES_PER_SEC(300);
- }
- sys_log(1, "DESTROY_WHEN_IDLE: %s", ch->GetName());
- ch->m_pkDestroyWhenIdleEvent = NULL;
- M2_DESTROY_CHARACTER(ch);
- return 0;
- }
- void CHARACTER::StartDestroyWhenIdleEvent()
- {
- if (m_pkDestroyWhenIdleEvent)
- return;
- char_event_info* info = AllocEventInfo<char_event_info>();
- info->ch = this;
- m_pkDestroyWhenIdleEvent = event_create(destroy_when_idle_event, info, PASSES_PER_SEC(300));
- }
- void CHARACTER::SetComboSequence(BYTE seq)
- {
- m_bComboSequence = seq;
- }
- BYTE CHARACTER::GetComboSequence() const
- {
- return m_bComboSequence;
- }
- void CHARACTER::SetLastComboTime(DWORD time)
- {
- m_dwLastComboTime = time;
- }
- DWORD CHARACTER::GetLastComboTime() const
- {
- return m_dwLastComboTime;
- }
- void CHARACTER::SetValidComboInterval(int interval)
- {
- m_iValidComboInterval = interval;
- }
- int CHARACTER::GetValidComboInterval() const
- {
- return m_iValidComboInterval;
- }
- BYTE CHARACTER::GetComboIndex() const
- {
- return m_bComboIndex;
- }
- void CHARACTER::IncreaseComboHackCount(int k)
- {
- m_iComboHackCount += k;
- if (m_iComboHackCount >= 10)
- {
- if (GetDesc())
- if (GetDesc()->DelayedDisconnect(number(2, 7)))
- {
- sys_log(0, "COMBO_HACK_DISCONNECT: %s count: %d", GetName(), m_iComboHackCount);
- LogManager::instance().HackLog("Combo", this);
- }
- }
- }
- void CHARACTER::ResetComboHackCount()
- {
- m_iComboHackCount = 0;
- }
- void CHARACTER::SkipComboAttackByTime(int interval)
- {
- m_dwSkipComboAttackByTime = get_dword_time() + interval;
- }
- DWORD CHARACTER::GetSkipComboAttackByTime() const
- {
- return m_dwSkipComboAttackByTime;
- }
- void CHARACTER::ResetChatCounter()
- {
- m_bChatCounter = 0;
- }
- BYTE CHARACTER::IncreaseChatCounter()
- {
- return ++m_bChatCounter;
- }
- BYTE CHARACTER::GetChatCounter() const
- {
- return m_bChatCounter;
- }
- // ¸»À̳ª ´Ù¸¥°ÍÀ» Ÿ°í ÀÖ³ª?
- bool CHARACTER::IsRiding() const
- {
- return IsHorseRiding() || GetMountVnum();
- }
- bool CHARACTER::CanWarp() const
- {
- const int iPulse = thecore_pulse();
- const int limit_time = PASSES_PER_SEC(g_nPortalLimitTime);
- if ((iPulse - GetSafeboxLoadTime()) < limit_time)
- return false;
- if ((iPulse - GetExchangeTime()) < limit_time)
- return false;
- if ((iPulse - GetMyShopTime()) < limit_time)
- return false;
- if ((iPulse - GetRefineTime()) < limit_time)
- return false;
- if (GetExchange() || GetMyShop() || GetShopOwner() || IsOpenSafebox() || IsCubeOpen())
- return false;
- return true;
- }
- DWORD CHARACTER::GetNextExp() const
- {
- if (PLAYER_EXP_TABLE_MAX < GetLevel())
- return 2500000000;
- else
- return exp_table[GetLevel()];
- }
- int CHARACTER::GetSkillPowerByLevel(int level, bool bMob) const
- {
- return CTableBySkill::instance().GetSkillPowerByLevelFromType(GetJob(), GetSkillGroup(), MINMAX(0, level, SKILL_MAX_LEVEL), bMob);
- }
- #ifdef __SASH_SYSTEM__
- void CHARACTER::OpenSash(bool bCombination)
- {
- if (isSashOpened(bCombination))
- {
- ChatPacket(CHAT_TYPE_INFO, LC_TEXT("The sash window it's already opened."));
- return;
- }
- if (bCombination)
- {
- if (m_bSashAbsorption)
- {
- ChatPacket(CHAT_TYPE_INFO, LC_TEXT("Before you may close the sash absorption window."));
- return;
- }
- m_bSashCombination = true;
- }
- else
- {
- if (m_bSashCombination)
- {
- ChatPacket(CHAT_TYPE_INFO, LC_TEXT("Before you may close the sash combine window."));
- return;
- }
- m_bSashAbsorption = true;
- }
- TItemPos tPos;
- tPos.window_type = INVENTORY;
- tPos.cell = 0;
- TPacketSash sPacket;
- sPacket.header = HEADER_GC_SASH;
- sPacket.subheader = SASH_SUBHEADER_GC_OPEN;
- sPacket.bWindow = bCombination;
- sPacket.dwPrice = 0;
- sPacket.bPos = 0;
- sPacket.tPos = tPos;
- sPacket.dwItemVnum = 0;
- sPacket.dwMinAbs = 0;
- sPacket.dwMaxAbs = 0;
- GetDesc()->Packet(&sPacket, sizeof(TPacketSash));
- ClearSashMaterials();
- }
- void CHARACTER::CloseSash()
- {
- if ((!m_bSashCombination) && (!m_bSashAbsorption))
- return;
- bool bWindow = (m_bSashCombination == true ? true : false);
- TItemPos tPos;
- tPos.window_type = INVENTORY;
- tPos.cell = 0;
- TPacketSash sPacket;
- sPacket.header = HEADER_GC_SASH;
- sPacket.subheader = SASH_SUBHEADER_GC_CLOSE;
- sPacket.bWindow = bWindow;
- sPacket.dwPrice = 0;
- sPacket.bPos = 0;
- sPacket.tPos = tPos;
- sPacket.dwItemVnum = 0;
- sPacket.dwMinAbs = 0;
- sPacket.dwMaxAbs = 0;
- GetDesc()->Packet(&sPacket, sizeof(TPacketSash));
- if (bWindow)
- m_bSashCombination = false;
- else
- m_bSashAbsorption = false;
- ClearSashMaterials();
- }
- void CHARACTER::ClearSashMaterials()
- {
- LPITEM * pkItemMaterial;
- pkItemMaterial = GetSashMaterials();
- for (int i = 0; i < SASH_WINDOW_MAX_MATERIALS; ++i)
- {
- if (!pkItemMaterial[i])
- continue;
- pkItemMaterial[i]->Lock(false);
- pkItemMaterial[i] = NULL;
- }
- }
- bool CHARACTER::SashIsSameGrade(long lGrade)
- {
- LPITEM * pkItemMaterial;
- pkItemMaterial = GetSashMaterials();
- if (!pkItemMaterial[0])
- return false;
- bool bReturn = (pkItemMaterial[0]->GetValue(SASH_GRADE_VALUE_FIELD) == lGrade ? true : false);
- return bReturn;
- }
- DWORD CHARACTER::GetSashCombinePrice(long lGrade)
- {
- DWORD dwPrice = 0;
- switch (lGrade)
- {
- case 2:
- {
- dwPrice = SASH_GRADE_2_PRICE;
- }
- break;
- case 3:
- {
- dwPrice = SASH_GRADE_3_PRICE;
- }
- break;
- case 4:
- {
- dwPrice = SASH_GRADE_4_PRICE;
- }
- break;
- default:
- {
- dwPrice = SASH_GRADE_1_PRICE;
- }
- break;
- }
- return dwPrice;
- }
- BYTE CHARACTER::CheckEmptyMaterialSlot()
- {
- LPITEM * pkItemMaterial;
- pkItemMaterial = GetSashMaterials();
- for (int i = 0; i < SASH_WINDOW_MAX_MATERIALS; ++i)
- {
- if (!pkItemMaterial[i])
- return i;
- }
- return 255;
- }
- void CHARACTER::GetSashCombineResult(DWORD & dwItemVnum, DWORD & dwMinAbs, DWORD & dwMaxAbs)
- {
- LPITEM * pkItemMaterial;
- pkItemMaterial = GetSashMaterials();
- if (m_bSashCombination)
- {
- if ((pkItemMaterial[0]) && (pkItemMaterial[1]))
- {
- long lVal = pkItemMaterial[0]->GetValue(SASH_GRADE_VALUE_FIELD);
- if (lVal == 4)
- {
- dwItemVnum = pkItemMaterial[0]->GetOriginalVnum();
- dwMinAbs = pkItemMaterial[0]->GetSocket(SASH_ABSORPTION_SOCKET);
- DWORD dwMaxAbsCalc = (dwMinAbs + SASH_GRADE_4_ABS_RANGE > SASH_GRADE_4_ABS_MAX ? SASH_GRADE_4_ABS_MAX : (dwMinAbs + SASH_GRADE_4_ABS_RANGE));
- dwMaxAbs = dwMaxAbsCalc;
- }
- else
- {
- DWORD dwMaskVnum = pkItemMaterial[0]->GetOriginalVnum();
- TItemTable * pTable = ITEM_MANAGER::instance().GetTable(dwMaskVnum + 1);
- if (pTable)
- dwMaskVnum += 1;
- dwItemVnum = dwMaskVnum;
- switch (lVal)
- {
- case 2:
- {
- dwMinAbs = SASH_GRADE_3_ABS;
- dwMaxAbs = SASH_GRADE_3_ABS;
- }
- break;
- case 3:
- {
- dwMinAbs = SASH_GRADE_4_ABS_MIN;
- dwMaxAbs = SASH_GRADE_4_ABS_MAX_COMB;
- }
- break;
- default:
- {
- dwMinAbs = SASH_GRADE_2_ABS;
- dwMaxAbs = SASH_GRADE_2_ABS;
- }
- break;
- }
- }
- }
- else
- {
- dwItemVnum = 0;
- dwMinAbs = 0;
- dwMaxAbs = 0;
- }
- }
- else
- {
- if ((pkItemMaterial[0]) && (pkItemMaterial[1]))
- {
- dwItemVnum = pkItemMaterial[0]->GetOriginalVnum();
- dwMinAbs = pkItemMaterial[0]->GetSocket(SASH_ABSORPTION_SOCKET);
- dwMaxAbs = dwMinAbs;
- }
- else
- {
- dwItemVnum = 0;
- dwMinAbs = 0;
- dwMaxAbs = 0;
- }
- }
- }
- void CHARACTER::AddSashMaterial(TItemPos tPos, BYTE bPos)
- {
- if (bPos >= SASH_WINDOW_MAX_MATERIALS)
- {
- if (bPos == 255)
- {
- bPos = CheckEmptyMaterialSlot();
- if (bPos >= SASH_WINDOW_MAX_MATERIALS)
- return;
- }
- else
- return;
- }
- LPITEM pkItem = GetItem(tPos);
- if (!pkItem)
- return;
- else if ((pkItem->GetCell() >= INVENTORY_MAX_NUM) || (pkItem->IsEquipped()) || (tPos.IsBeltInventoryPosition()) || (pkItem->IsDragonSoul()))
- return;
- else if ((pkItem->GetType() != ITEM_COSTUME) && (m_bSashCombination))
- return;
- else if ((pkItem->GetType() != ITEM_COSTUME) && (bPos == 0) && (m_bSashAbsorption))
- return;
- else if (pkItem->isLocked())
- {
- ChatPacket(CHAT_TYPE_INFO, LC_TEXT("You can't add locked items."));
- return;
- }
- else if ((m_bSashCombination) && (bPos == 1) && (!SashIsSameGrade(pkItem->GetValue(SASH_GRADE_VALUE_FIELD))))
- {
- ChatPacket(CHAT_TYPE_INFO, LC_TEXT("You can combine just sashes of same grade."));
- return;
- }
- else if ((m_bSashCombination) && (pkItem->GetSocket(SASH_ABSORPTION_SOCKET) >= SASH_GRADE_4_ABS_MAX))
- {
- ChatPacket(CHAT_TYPE_INFO, LC_TEXT("This sash got already maximum absorption chance."));
- return;
- }
- else if ((bPos == 1) && (m_bSashAbsorption))
- {
- if ((pkItem->GetType() != ITEM_WEAPON) && (pkItem->GetType() != ITEM_ARMOR))
- {
- ChatPacket(CHAT_TYPE_INFO, LC_TEXT("You can absorb just the bonuses from armors and weapons."));
- return;
- }
- else if ((pkItem->GetType() == ITEM_ARMOR) && (pkItem->GetSubType() != ARMOR_BODY))
- {
- ChatPacket(CHAT_TYPE_INFO, LC_TEXT("You can absorb just the bonuses from armors and weapons."));
- return;
- }
- }
- else if ((pkItem->GetSubType() != COSTUME_SASH) && (m_bSashCombination))
- return;
- else if ((pkItem->GetSubType() != COSTUME_SASH) && (bPos == 0) && (m_bSashAbsorption))
- return;
- else if ((pkItem->GetSocket(SASH_ABSORBED_SOCKET) > 0) && (bPos == 0) && (m_bSashAbsorption))
- return;
- LPITEM * pkItemMaterial;
- pkItemMaterial = GetSashMaterials();
- if ((bPos == 1) && (!pkItemMaterial[0]))
- return;
- if (pkItemMaterial[bPos])
- return;
- pkItemMaterial[bPos] = pkItem;
- pkItemMaterial[bPos]->Lock(true);
- DWORD dwItemVnum, dwMinAbs, dwMaxAbs;
- GetSashCombineResult(dwItemVnum, dwMinAbs, dwMaxAbs);
- TPacketSash sPacket;
- sPacket.header = HEADER_GC_SASH;
- sPacket.subheader = SASH_SUBHEADER_GC_ADDED;
- sPacket.bWindow = m_bSashCombination == true ? true : false;
- sPacket.dwPrice = GetSashCombinePrice(pkItem->GetValue(SASH_GRADE_VALUE_FIELD));
- sPacket.bPos = bPos;
- sPacket.tPos = tPos;
- sPacket.dwItemVnum = dwItemVnum;
- sPacket.dwMinAbs = dwMinAbs;
- sPacket.dwMaxAbs = dwMaxAbs;
- GetDesc()->Packet(&sPacket, sizeof(TPacketSash));
- }
- void CHARACTER::RemoveSashMaterial(BYTE bPos)
- {
- if (bPos >= SASH_WINDOW_MAX_MATERIALS)
- return;
- LPITEM * pkItemMaterial;
- pkItemMaterial = GetSashMaterials();
- DWORD dwPrice = 0;
- if (bPos == 1)
- {
- if (pkItemMaterial[bPos])
- {
- pkItemMaterial[bPos]->Lock(false);
- pkItemMaterial[bPos] = NULL;
- }
- if (pkItemMaterial[0])
- dwPrice = GetSashCombinePrice(pkItemMaterial[0]->GetValue(SASH_GRADE_VALUE_FIELD));
- }
- else
- ClearSashMaterials();
- TItemPos tPos;
- tPos.window_type = INVENTORY;
- tPos.cell = 0;
- TPacketSash sPacket;
- sPacket.header = HEADER_GC_SASH;
- sPacket.subheader = SASH_SUBHEADER_GC_REMOVED;
- sPacket.bWindow = m_bSashCombination == true ? true : false;
- sPacket.dwPrice = dwPrice;
- sPacket.bPos = bPos;
- sPacket.tPos = tPos;
- sPacket.dwItemVnum = 0;
- sPacket.dwMinAbs = 0;
- sPacket.dwMaxAbs = 0;
- GetDesc()->Packet(&sPacket, sizeof(TPacketSash));
- }
- BYTE CHARACTER::CanRefineSashMaterials()
- {
- BYTE bReturn = 0;
- LPITEM * pkItemMaterial;
- pkItemMaterial = GetSashMaterials();
- if (m_bSashCombination)
- {
- for (int i = 0; i < SASH_WINDOW_MAX_MATERIALS; ++i)
- {
- if (pkItemMaterial[i])
- {
- if ((pkItemMaterial[i]->GetType() == ITEM_COSTUME) && (pkItemMaterial[i]->GetSubType() == COSTUME_SASH))
- bReturn = 1;
- else
- {
- bReturn = 0;
- break;
- }
- }
- else
- {
- bReturn = 0;
- break;
- }
- }
- }
- else if (m_bSashAbsorption)
- {
- if ((pkItemMaterial[0]) && (pkItemMaterial[1]))
- {
- if ((pkItemMaterial[0]->GetType() == ITEM_COSTUME) && (pkItemMaterial[0]->GetSubType() == COSTUME_SASH))
- bReturn = 2;
- else
- bReturn = 0;
- if ((pkItemMaterial[1]->GetType() == ITEM_WEAPON) || ((pkItemMaterial[1]->GetType() == ITEM_ARMOR) && (pkItemMaterial[1]->GetSubType() == ARMOR_BODY)))
- bReturn = 2;
- else
- bReturn = 0;
- if (pkItemMaterial[0]->GetSocket(SASH_ABSORBED_SOCKET) > 0)
- bReturn = 0;
- }
- else
- bReturn = 0;
- }
- return bReturn;
- }
- void CHARACTER::RefineSashMaterials()
- {
- BYTE bCan = CanRefineSashMaterials();
- if (bCan == 0)
- return;
- LPITEM * pkItemMaterial;
- pkItemMaterial = GetSashMaterials();
- DWORD dwItemVnum, dwMinAbs, dwMaxAbs;
- GetSashCombineResult(dwItemVnum, dwMinAbs, dwMaxAbs);
- DWORD dwPrice = GetSashCombinePrice(pkItemMaterial[0]->GetValue(SASH_GRADE_VALUE_FIELD));
- if (bCan == 1)
- {
- int iSuccessChance = 0;
- long lVal = pkItemMaterial[0]->GetValue(SASH_GRADE_VALUE_FIELD);
- switch (lVal)
- {
- case 2:
- {
- iSuccessChance = SASH_COMBINE_GRADE_2;
- }
- break;
- case 3:
- {
- iSuccessChance = SASH_COMBINE_GRADE_3;
- }
- break;
- case 4:
- {
- iSuccessChance = SASH_COMBINE_GRADE_4;
- }
- break;
- default:
- {
- iSuccessChance = SASH_COMBINE_GRADE_1;
- }
- break;
- }
- if (GetGold() < dwPrice)
- {
- ChatPacket(CHAT_TYPE_INFO, LC_TEXT("You don't have enough Yang."));
- return;
- }
- int iChance = number(1, 100);
- bool bSucces = (iChance <= iSuccessChance ? true : false);
- if (bSucces)
- {
- LPITEM pkItem = ITEM_MANAGER::instance().CreateItem(dwItemVnum, 1, 0, false);
- if (!pkItem)
- {
- sys_err("%d can't be created.", dwItemVnum);
- return;
- }
- ITEM_MANAGER::CopyAllAttrTo(pkItemMaterial[0], pkItem);
- LogManager::instance().ItemLog(this, pkItem, "COMBINE SUCCESS", pkItem->GetName());
- DWORD dwAbs = (dwMinAbs == dwMaxAbs ? dwMinAbs : number(dwMinAbs + 1, dwMaxAbs));
- pkItem->SetSocket(SASH_ABSORPTION_SOCKET, dwAbs);
- pkItem->SetSocket(SASH_ABSORBED_SOCKET, pkItemMaterial[0]->GetSocket(SASH_ABSORBED_SOCKET));
- PointChange(POINT_GOLD, -dwPrice);
- DBManager::instance().SendMoneyLog(MONEY_LOG_REFINE, pkItemMaterial[0]->GetVnum(), -dwPrice);
- WORD wCell = pkItemMaterial[0]->GetCell();
- ITEM_MANAGER::instance().RemoveItem(pkItemMaterial[0], "COMBINE (REFINE SUCCESS)");
- ITEM_MANAGER::instance().RemoveItem(pkItemMaterial[1], "COMBINE (REFINE SUCCESS)");
- pkItem->AddToCharacter(this, TItemPos(INVENTORY, wCell));
- ITEM_MANAGER::instance().FlushDelayedSave(pkItem);
- pkItem->AttrLog();
- if (lVal == 4)
- ChatPacket(CHAT_TYPE_INFO, LC_TEXT("New absorption rate: %d%"), dwAbs);
- else
- ChatPacket(CHAT_TYPE_INFO, LC_TEXT("Success."));
- EffectPacket(SE_EFFECT_SASH_SUCCEDED);
- LogManager::instance().SashLog(GetPlayerID(), GetX(), GetY(), dwItemVnum, pkItem->GetID(), 1, dwAbs, 1);
- ClearSashMaterials();
- }
- else
- {
- PointChange(POINT_GOLD, -dwPrice);
- DBManager::instance().SendMoneyLog(MONEY_LOG_REFINE, pkItemMaterial[0]->GetVnum(), -dwPrice);
- ITEM_MANAGER::instance().RemoveItem(pkItemMaterial[1], "COMBINE (REFINE FAIL)");
- if (lVal == 4)
- ChatPacket(CHAT_TYPE_INFO, LC_TEXT("New absorption rate: %d%"), pkItemMaterial[0]->GetSocket(SASH_ABSORPTION_SOCKET));
- else
- ChatPacket(CHAT_TYPE_INFO, LC_TEXT("Failed."));
- LogManager::instance().SashLog(GetPlayerID(), GetX(), GetY(), dwItemVnum, 0, 0, 0, 0);
- pkItemMaterial[1] = NULL;
- }
- TItemPos tPos;
- tPos.window_type = INVENTORY;
- tPos.cell = 0;
- TPacketSash sPacket;
- sPacket.header = HEADER_GC_SASH;
- sPacket.subheader = SASH_SUBHEADER_CG_REFINED;
- sPacket.bWindow = m_bSashCombination == true ? true : false;
- sPacket.dwPrice = dwPrice;
- sPacket.bPos = 0;
- sPacket.tPos = tPos;
- sPacket.dwItemVnum = 0;
- sPacket.dwMinAbs = 0;
- if (bSucces)
- sPacket.dwMaxAbs = 100;
- else
- sPacket.dwMaxAbs = 0;
- GetDesc()->Packet(&sPacket, sizeof(TPacketSash));
- }
- else
- {
- pkItemMaterial[1]->CopyAttributeTo(pkItemMaterial[0]);
- LogManager::instance().ItemLog(this, pkItemMaterial[0], "ABSORB (REFINE SUCCESS)", pkItemMaterial[0]->GetName());
- pkItemMaterial[0]->SetSocket(SASH_ABSORBED_SOCKET, pkItemMaterial[1]->GetOriginalVnum());
- for (int i = 0; i < ITEM_ATTRIBUTE_MAX_NUM; ++i)
- {
- if (pkItemMaterial[0]->GetAttributeValue(i) < 0)
- pkItemMaterial[0]->SetForceAttribute(i, pkItemMaterial[0]->GetAttributeType(i), 0);
- }
- ITEM_MANAGER::instance().RemoveItem(pkItemMaterial[1], "ABSORBED (REFINE SUCCESS)");
- ITEM_MANAGER::instance().FlushDelayedSave(pkItemMaterial[0]);
- pkItemMaterial[0]->AttrLog();
- ChatPacket(CHAT_TYPE_INFO, LC_TEXT("Success."));
- ClearSashMaterials();
- TItemPos tPos;
- tPos.window_type = INVENTORY;
- tPos.cell = 0;
- TPacketSash sPacket;
- sPacket.header = HEADER_GC_SASH;
- sPacket.subheader = SASH_SUBHEADER_CG_REFINED;
- sPacket.bWindow = m_bSashCombination == true ? true : false;
- sPacket.dwPrice = dwPrice;
- sPacket.bPos = 255;
- sPacket.tPos = tPos;
- sPacket.dwItemVnum = 0;
- sPacket.dwMinAbs = 0;
- sPacket.dwMaxAbs = 1;
- GetDesc()->Packet(&sPacket, sizeof(TPacketSash));
- }
- }
- bool CHARACTER::CleanSashAttr(LPITEM pkItem, LPITEM pkTarget)
- {
- if (!CanHandleItem())
- return false;
- else if ((!pkItem) || (!pkTarget))
- return false;
- else if ((pkTarget->GetType() != ITEM_COSTUME) && (pkTarget->GetSubType() != COSTUME_SASH))
- return false;
- if (pkTarget->GetSocket(SASH_ABSORBED_SOCKET) <= 0)
- return false;
- pkTarget->SetSocket(SASH_ABSORBED_SOCKET, 0);
- for (int i = 0; i < ITEM_ATTRIBUTE_MAX_NUM; ++i)
- pkTarget->SetForceAttribute(i, 0, 0);
- pkItem->SetCount(pkItem->GetCount() - 1);
- LogManager::instance().ItemLog(this, pkTarget, "USE_DETACHMENT (CLEAN ATTR)", pkTarget->GetName());
- return true;
- }
- #endif
Danke im Voraus an jeden der sich die Zeit nimmt um zu helfen.
€: Syserr Ch1: SYSERR: Sep 1 15:33:04 :: EquipTo: EquipTo: invalid wear cell (this: #85018 Königsband (maßgef.) wearflag: 0 cell: 32)
€: Gefixxt! Lag an der Position von WEAR_COSTUME_SASH in ItemData.h
Es besteht dennoch das Problem mit dem Effect der Items.
Greets.