using MySql.Data.MySqlClient; using Newtonsoft.Json; using System; using System.Collections.Generic; using System.Diagnostics; using System.Drawing; //using System.Drawing.Imaging; using System.IO; using System.Linq; using System.Reflection; using System.Text.RegularExpressions; using C = ClientPackets; using S = ServerPackets; public class ExchangeConfigGroup { public string Name; public List ExchangeConfigGroupInfos = new List(); public bool IsTypeGroup=false; public string GroupDescription; public override string ToString() { return Name; } } public class ExchangeConfigGroupInfo { public string Description { get; set; } = "默认"; [Newtonsoft.Json.JsonIgnore] public int InputGold { get { return ItemCounts[6]; } set { ItemCounts[6] = value; } } [Newtonsoft.Json.JsonIgnore] public int InputZanzhu { get { return ItemCounts[7]; } set { ItemCounts[7] = value; } } [Newtonsoft.Json.JsonIgnore] public int InputItem1Index { get { return ItemIndexs[0]; } set { ItemIndexs[0] = value; } } [Newtonsoft.Json.JsonIgnore] public int InputItem1Count { get { return ItemCounts[0]; } set { ItemCounts[0] = value; } } [Newtonsoft.Json.JsonIgnore] public int InputItem2Index { get { return ItemIndexs[1]; } set { ItemIndexs[1] = value; } } [Newtonsoft.Json.JsonIgnore] public int InputItem2Count { get { return ItemCounts[1]; } set { ItemCounts[1] = value; } } [Newtonsoft.Json.JsonIgnore] public int InputItem3Index { get { return ItemIndexs[2]; } set { ItemIndexs[2] = value; } } [Newtonsoft.Json.JsonIgnore] public int InputItem3Count { get { return ItemCounts[2]; } set { ItemCounts[2] = value; } } [Newtonsoft.Json.JsonIgnore] public int OutputGold { get { return ItemCounts[8]; } set { ItemCounts[8] = value; } } [Newtonsoft.Json.JsonIgnore] public int OutputZanzhu { get { return ItemCounts[9]; } set { ItemCounts[9] = value; } } [Newtonsoft.Json.JsonIgnore] public int OutputItem1Index { get { return ItemIndexs[3]; } set { ItemIndexs[3] = value; } } [Newtonsoft.Json.JsonIgnore] public int OutputItem1Count { get { return ItemCounts[3]; } set { ItemCounts[3] = value; } } [Newtonsoft.Json.JsonIgnore] public int OutputItem2Index { get { return ItemIndexs[4]; } set { ItemIndexs[4] = value; } } [Newtonsoft.Json.JsonIgnore] public int OutputItem2Count { get { return ItemCounts[4]; } set { ItemCounts[4] = value; } } [Newtonsoft.Json.JsonIgnore] public int OutputItem3Index { get { return ItemIndexs[5]; } set { ItemIndexs[5] = value; } } [Newtonsoft.Json.JsonIgnore] public int OutputItem3Count { get { return ItemCounts[5]; } set { ItemCounts[5] = value; } } public List ItemIndexs { get; set; } public List ItemCounts { get; set; } public override string ToString() { return Description; } public bool IsAvaliable { get { return (InputGold > 0 || InputZanzhu > 0 || (InputItem1Index != -1 && InputItem1Count > 0) || (InputItem2Index != -1 && InputItem2Count > 0) || (InputItem3Index != -1 && InputItem3Count > 0)) && (OutputGold > 0 || OutputZanzhu > 0 || (OutputItem1Index != -1 && OutputItem1Count > 0) || (OutputItem2Index != -1 && OutputItem2Count > 0) || (OutputItem3Index != -1 && OutputItem3Count > 0)); } } } public class ExchangeConfigGroupInfoNew { public string Description { get; set; } = "默认"; public int InputGold { get; set; } = 0; public int InputZanzhu { get; set; } = 0; public int InputItem1Index { get { return ItemIndexs[0]; } set{ ItemIndexs[0] = value; } } public int InputItem1Count { get { return ItemCounts[0]; } set { ItemCounts[0] = value; } } public int InputItem2Index { get { return ItemIndexs[1]; } set { ItemIndexs[1] = value; } } public int InputItem2Count { get { return ItemCounts[1]; } set { ItemCounts[1] = value; } } public int InputItem3Index { get { return ItemIndexs[2]; } set { ItemIndexs[2] = value; } } public int InputItem3Count { get { return ItemCounts[2]; } set { ItemCounts[2] = value; } } public int OutputGold { get; set; } = 0; public int OutputZanzhu { get; set; } = 0; public int OutputItem1Index { get { return ItemIndexs[3]; } set { ItemIndexs[3] = value; } } public int OutputItem1Count { get { return ItemCounts[3]; } set { ItemCounts[3] = value; } } public int OutputItem2Index { get { return ItemIndexs[4]; } set { ItemIndexs[4] = value; } } public int OutputItem2Count { get { return ItemCounts[4]; } set { ItemCounts[4] = value; } } public int OutputItem3Index { get { return ItemIndexs[5]; } set { ItemIndexs[5] = value; } } public int OutputItem3Count { get { return ItemCounts[5]; } set { ItemCounts[5] = value; } } public List ItemIndexs { get; set; } public List ItemCounts { get; set; } public override string ToString() { return Description; } public bool IsAvaliable { get { return (InputGold > 0 || InputZanzhu > 0 || (InputItem1Index != -1 && InputItem1Count > 0) || (InputItem2Index != -1 && InputItem2Count > 0) || (InputItem3Index != -1 && InputItem3Count > 0)) && (OutputGold > 0 || OutputZanzhu > 0 || (OutputItem1Index != -1 && OutputItem1Count > 0) || (OutputItem2Index != -1 && OutputItem2Count > 0) || (OutputItem3Index != -1 && OutputItem3Count > 0)); } } } public class TreasureOutput { public int ItemIndex; public uint Count; } public class GameShopItemInfo { public int ImageIndex { get; set; } = -1; public int ItemIndex { get; set; } public int ItemCount { get; set; } public int Price { get; set; } } public class GameShopGroupInfo { public string Name { get; set; } public List GameShopItemInfos { get; set; } } public class AwakeInfos { public List AwakeInfoList = new List(); public int Grade1AwakeLevel = 3; public int Grade2AwakeLevel = 4; public int Grade3AwakeLevel = 6; public int Grade4AwakeLevel = 6; } public class AwakeInfo { public AwakeType AwakeType { get; set; } public ItemType ItemType { get; set; } public List LevelValues { get; set; } public override string ToString() { return AwakeType.ToString(); } } public static class Scope { public readonly static Stopwatch Timer = Stopwatch.StartNew(); } public enum ManagerUUID : short { MirCommand = -1, MirReturn = 1, MirConfig, SwitchPort, } public enum BlendMode : sbyte { NONE = -1, NORMAL = 0, LIGHT = 1, LIGHTINV = 2, INVNORMAL = 3, INVLIGHT = 4, INVLIGHTINV = 5, INVCOLOR = 6, INVBACKGROUND = 7 } public enum DamageType : byte { Hit = 0, Miss = 1, Critical = 2, Recovery = 3, Poison = 4, Parry = 5 } [Flags] public enum GMOptions : byte { None = 0, GameMaster = 0x0001, Observer = 0x0002, Superman = 0x0004 } public enum AwakeType : byte { None = 0, 物防, 法防, 暴击伤害, 冰冻, 毒攻击, 准确, 伤害反弹, 增加血量, 毒物抵抗, 中毒恢复, 生命恢复, 魔法恢复, 暴击率, 魔法免疫, 幸运, 物理防御率, 魔法防御率, 无视物防, 无视魔防御, 格挡 } [Flags] public enum LevelEffects : byte { None = 0, Mist = 0x0001, RedDragon = 0x0002, BlueDragon = 0x0004 } public enum OutputMessageType : byte { Normal, Quest, } enum Element : byte { 火 = 0, 冰 = 1, 雷 = 2, 风 = 3, 神圣 = 4, 暗黑 = 5, 幻影 = 6, } enum Elementss : byte { 火焰 = 0, 冰寒 = 1, 雷击 = 2, 风 = 3, 神圣 = 4, 暗黑 = 5, 幻影 = 6, } public class EquipCombineConfig { public List Names; public uint GoldNeed; public Dictionary ItemNeeds; } public enum ItemGrade : byte { None = 0, 一般 = 1,//Common 高级 = 2,//Rare 稀有 = 3,//Legendary 神器 = 4,//Mythical } public enum StatType : byte { AC = 0, MAC = 1, DC = 2, MC = 3, SC = 4, HP = 5, MP = 6, HP_Percent = 7, MP_Percent = 8, HP_Regen = 9, MP_Regen = 10, ASpeed = 11, Luck = 12, Strong = 13, Accuracy = 14, Agility = 15, MagicResist = 16, PoisonResist = 17, PoisonAttack = 18, PoisonRegen = 19, Freezing = 20, Holy = 21, Durability = 22, Unknown = 23 } public enum RefinedValue : byte { None = 0, DC = 1, MC = 2, SC = 3, FireAC = 4, IceAC = 5, WindAC = 6, LightAC = 7, HolyAC = 8, DarkAC = 9, PhantomAC = 10, } public enum QuestType : byte { General = 0, Daily = 1, Repeatable = 2, Story = 3, Random = 4, Season = 5, WanShiTong=6 } public enum QuestIcon : byte { None = 0, QuestionWhite = 1, ExclamationYellow = 2, QuestionYellow = 3, ExclamationBlue = 5, QuestionBlue = 6, ExclamationGreen = 7, QuestionGreen = 8 } public enum QuestState : byte { Add, Update, Remove, None, } public enum DefaultNPCType : byte { Login, LevelUp, UseItem, MapCoord, MapEnter, Die, Trigger, CustomCommand, OnAcceptQuest, OnFinishQuest, Daily, TalkMonster } public enum IntelligentCreatureType : byte { None = 99, BabyPig = 0, Chick = 1, Kitten = 2, BabySkeleton = 3, Baekdon = 4, Wimaen = 5, BlackKitten = 6, BabyDragon = 7, OlympicFlame = 8, BabySnowMan = 9, Frog = 10, BabyMonkey = 11 } //1 blank mob files //7 mob frames not added //2 blank frame sets (92, 173) //4 mob frames duplicate of other frame sets //TODO: add 2 missing frames in to blank frames, remove 2 duplicate frames (leaving no blanks and 2 duplicates) public enum Monster : ushort { 沙漠蜥蜴 = 0, 夜行鬼 = 1, 触角神魔 = 2, 沙鬼0 = 3, 沙漠石人 = 4, 异界之门 = 5, 轻甲守卫 = 6, 蚂蚁道士 = 7, 盔甲蚂蚁 = 8, 海神将领 = 9, 霸王守卫 = 10, 犬猴魔 = 12, 大法老 = 13, 蚂蚁战士 = 14, 劳动蚂蚁 = 16, 诺玛将士 = 17, 诺玛0 = 18, 红衣法师 = 19, 鸡 = 20, 鹿 = 21, 半兽人 = 22, 半兽战士 = 23, 半兽勇士 = 24, 毒蜘蛛 = 25, 卫士 = 26, 蛤蟆 = 27, 蝎子 = 28, 山洞蝙蝠 = 29, 森林雪人 = 30, 食人花 = 31, 骷髅 = 32, 掷斧骷髅 = 33, 骷髅战士 = 34, 骷髅战将 = 35, 骷髅精灵 = 36, 洞蛆 = 37, 多钩猫 = 38, 钉耙猫 = 39, 稻草人 = 40, 沃玛战士 = 41, 沃玛勇士 = 42, 火焰沃玛 = 43, 沃玛护卫 = 44, 沃玛教主 = 45, 暗黑战士 = 46, 粪虫 = 47, 僵尸1 = 48, 僵尸2 = 49, 僵尸3 = 50, 僵尸4 = 51, 僵尸5 = 52, 尸王 = 53, 红蛇 = 54, 练功师 = 55, 变异骷髅 = 56, 虎蛇 = 57, 羊 = 58, 猎鹰 = 59, 盔甲虫 = 60, 威思而小虫 = 62, 多角虫 = 63, 巨型多角虫 = 64, 狼 = 65, 蜈蚣 = 66, 触龙神 = 67, 黑色恶蛆 = 68, 钳虫 = 69, 邪恶钳虫 = 70, 跳跳蜂 = 71, 蝴蝶虫 = 72, 角蝇 = 73, 蝙蝠 = 74, 楔蛾 = 75, 红野猪 = 76, 黑野猪 = 77, 白野猪 = 78, 蝎蛇 = 79, 邪恶毒蛇 = 80, 大老鼠 = 81, 祖玛弓箭手 = 82, 祖玛雕像 = 83, 祖玛卫士 = 84, 祖玛教主 = 85, 弓箭手 = 86, 神兽 = 89, 神兽1 = 90, 沃玛战将 = 91, 恶形鬼 = 92, 爆毒神魔 = 93, 沙漠鱼魔 = 94, 沙漠树魔 = 95, 爆毒蚂蚁 = 96, 沙漠风魔 = 97, 驽马王 = 98, 神舰守卫 = 99, 月魔蜘蛛 = 101, 独眼蜘蛛 = 102, 天狼蜘蛛 = 103, 赤月恶魔 = 104, 爆裂蜘蛛 = 105, 幻影蜘蛛 = 106, 血巨人 = 107, 血金刚 = 108, 赤血恶魔 = 109, 灰血恶魔 = 110, 花色蜘蛛 = 111, 黑角蜘蛛1 = 112, 卫士1 = 113, 图书馆护卫 = 114, 沙漠战士 = 115, 褐色马 = 116, 白马 = 117, 黑马 = 118, 赤兔马 = 118, 猪 = 119, 霸王教主 = 120, 牛 = 121, 诺玛1 = 122, 篮球 = 123, 新人女助手 = 124, 新人男助手 = 125, 七点白蛇 = 126, 栗子树 = 127, 诺玛2 = 128, 诺玛3 = 129, 潘夜右护卫 = 130, 潘夜左护卫 = 131, 腐蚀人鬼 = 132, 潘夜冰魔 = 133, 潘夜云魔 = 134, 潘夜风魔 = 135, 潘夜火魔 = 136, 潘夜战士 = 137, 年兽 = 137, 浪子人鬼 = 138, 潘夜牛魔王 = 139, 骷髅武将 = 140, 骷髅教主 = 141, 骷髅士兵 = 142, 骷髅武士 = 143, 骷髅弓箭手 = 144, 多脚虫1 = 145, 多脚虫2 = 146, 胞眼虫1 = 147, 胞眼虫2 = 148, 蜘蛛娃 = 149, 赤黄猪王 = 150, 圣诞鹿 = 151, 怒龙神 = 152, 圣诞树 = 153, 猿猴战士 = 154, 圣诞老人 = 155, 魔神怪1 = 156, 魔神怪2 = 157, 巨象兽 = 158, 火焰狮子 = 159, 石像狮子 = 160, 武力神将 = 161, 地牢女神1 = 162, 地牢女神2 = 163, 震天魔神 = 164, 丛林战士1 = 165, 丛林战士2 = 166, 投石车 = 167, 弩车 = 169, 冰魄女神 = 170, 野猪 = 171, 寒冰守护神 = 172, 木障 = 173, 雄诺玛 = 174, 雌诺玛 = 175, 溪谷法师 = 175, 溪谷战士 = 176, 溪谷使者 = 177, 溪谷邪神 = 178, 诺玛卫士 = 179, 木栅栏8 = 179, 诺玛骑兵 = 180, 诺玛装甲兵 = 181, 诺玛抛石兵 = 183, 诺玛司令 = 184, 诺玛斧兵 = 185, 诺玛教主 = 186, 聚宝箱1 = 188, 木栅栏7 = 189, 寒冰射手 = 200, 寒冰半兽战士 = 201, 寒冰巫师 = 202, 寒冰法师 = 203, 寒冰无头骑士 = 204, 寒冰帝王 = 205, 寒冰斧兵 = 206, 寒冰狼人 = 207, 寒冰白狼 = 208, 寒冰链手 = 209, 绝情护卫 = 210, 绝情战士 = 211, 绝情红姬 = 212, 绝情绿姬 = 213, 熔岩战士 = 220, 熔岩魔龙 = 221, 熔岩祭司 = 222, 熔岩魔兵 = 223, 熔岩穿甲兵 = 224, 熔岩收割者 = 225, 熔岩魔法师 = 226, 月河变异者 = 227, 月河巫师 = 228, 月河大门 = 229, 月河野蛮人 = 230, 月河勇士 = 231, 月河死神 = 232, 月河刺客 = 233, 月河树妖 = 234, 月河门卫 = 235, 月河剑客 = 236, 圣殿左护卫 = 240, 圣殿右护卫 = 241, 圣殿左守卫 = 242, 圣殿右守卫 = 243, 圣殿左判官 = 244, 圣殿右判官 = 245, 圣殿阴魂 = 246, 圣殿阳魂 = 247, 圣兽1 = 250, 圣兽2 = 252, 圣兽3 = 253, 丛林掠夺者 = 260, 丛林魔法师 = 261, 丛林潜行者 = 262, 丛林之王 = 263, 丛林穿刺者 = 264, 丛林金罐子 = 265, 潜行男 = 266, 潜行女 = 267, 沃玛锤兵 = 268, 沙漠蜥蜴新 = 270, 沙鬼新 = 271, 诺玛将军 = 272, 蚂蚁战士新 = 273, 半兽人新 = 274, 蛤蟆新 = 275, 钉耙猫新 = 276, 蛤蟆新二 = 277, 独眼蜘蛛1 = 278, 天狼蜘蛛1 = 279, 石头人 = 280, 诺玛守卫 = 281, 诺玛祭司 = 282, 霸王幽灵 = 283, 黑衣法师 = 284, 神舰鳄鱼 = 285, 虹魔教主 = 286, 诺马小怪 = 287, 野蛮人 = 288, 绿色半兽战士 = 289, 猿猴战将 = 290, 白色森林雪人 = 291, 盘龙柱 = 292, 鸭子 = 293, 兔子 = 294, 骨头堆 = 295, 足球 = 296, 小巫师 = 297, 红巫师 = 298, 卧龙教主=300, 月河巡逻使=301, 月河督抚使=302, 变异迅猛蜥 = 311, 变异刺骨蜥 = 312, 变异丑蜥 = 313, 变异毒蜥 = 314, 变异利爪蜥 = 319, 魔石咆哮者 = 315, 魔石狂热者 = 316, 魔石守护神 = 317, 地天灭王 = 318, 冰魂弓箭手 = 320, 冰魂半兽战士 = 321, 冰魂武将0 = 322, 冰魂武将 = 323, 冰魂骑手 = 324, 冰城帝王 = 325, 冰魂武士 = 326, 狼人 = 327, 雪狼 = 328, 冰魂斧兵 = 329, 狂兽人猎手=330, 狂兽人萨满0=331, 嗜魂兽=332, 骷髅翼龙=333, 骷髅狂兽=334, 狂兽人萨满=335, 狂兽人骑兵=336, 护卫将军 =340, 黎明女王=341, 舞姬=342, 绿姬=343, 蚩尤将军=350, 赤龙魔王=351, 赤龙女王=352, 无影魔卒 = 353, 无影魔将 = 354, 阎昆将军 = 355, 阎昆魔女 = 356, 真幻鬼 = 357, 真幻魔将 = 358, 千年白虎王= 368, 霸王虎= 367, 白翼虎= 366, 黑翼虎= 365, 黑虎= 364, 冰虎= 363, 血虎= 362, 黄虎= 361, 纯虎= 360, 皇陵将军俑 =379, 皇陵护卫兵俑= 378, 皇陵戟骑兵俑= 377, 皇陵刀骑兵俑= 376, 皇陵戟兵俑= 375, 皇陵刀兵俑= 374, 石化金刚= 371, 真炎剑魔= 370, 赤岩龙= 388, 赤岩龙将军 =385, 赤岩龙战士 =384, 红爪之龙 =383, 破趾之龙 =382, 月下莲= 381, 月莲树= 380, 月河教主= 435, 堕落幻影使= 434, 堕落勾魂使 =433, 堕落禁卫= 432, 堕落勇士 =431, 堕落红毛 =426, 堕落马面 =425, 树人精灵 =424, 堕落战士 =423, 堕落鼠仙 =422, 堕落罗汉 =421, 堕落幽灵 =420, 六角魔王 =413, 银猴= 412, 雪兔= 411, 红兔=410, 沼泽石鬼 =409, 弧形鬼= 408, 灵验鬼= 407, 斩鬼 =406, 猛犸象= 405, 铁甲犀牛 =404, 黑鬃虎 =403, 白鬃虎 =402, 赤耳狼= 401, 白耳狼 =400, 幻影禁卫= 399, 混沌禁卫= 398, 灭绝禁卫= 397, 破坏禁卫= 396, 禁卫将军= 395, 蝙蝠怪2= 394, 蝙蝠怪= 393, 青岩龙= 392, 禁卫队长= 391, 禁卫战士 =390, 黑蟒= 458, 山贼运宝车队= 456, 盗贼运宝车队= 455, 暗影鬼迹= 454, 巨型鼹鼠= 453, 剧毒蝎子= 452, 沙尘暴= 451, 烈炎眼镜蛇= 450, 山贼头领= 449, 山贼= 448, 盗贼= 447, 女刺客 =446, 修道僧 =445, 泰山战狼= 444, 变卦法师= 443, 伏兵= 442, 石人怪 =441, 爆炎石人怪 =440, 沙巴克城门1 = 530, 沙巴克城门2 = 531, 沙巴克城门3 = 532, 沙巴克城门4 = 533, 木栅栏1 = 534, 木栅栏2 = 535, 木栅栏3 = 536, 木栅栏4 = 537, 诺玛城门 = 538, 白眼钳虫 = 2000, 青铜钳虫 = 2004, 沃角钳虫 = 2005, 白月黑色恶蛆 = 2030, 金刚黑色恶蛆 = 2033, 沃毒黑色恶蛆 = 2034, 洞穴蜈蚣 = 2042, 沃毒蜈蚣 = 2045, 邪恶蜈蚣61 = 2046, 我的宝宝6 = 3078, 我的宝宝2 = 3591, 我的宝宝4 = 4104, 金龙神 } public enum MirAction : byte { Standing, Walking, Running, Pushed, DashL, DashR, DashFail, Stance, Stance2, Attack1, Attack2, Attack3, Attack4, Attack5, Attack6, Attack7, AttackRange1, AttackRange2, AttackRange3, Special, Struck, Harvest, Spell, Spell2, Die, Dead, Skeleton, Show, Hide, Stoned, Appear, Revive, SitDown, Mine, Sneek, DashAttack, Lunge, WalkingBow, RunningBow, Jump, MountStanding, MountWalking, MountRunning, MountStruck, MountAttack, FishingCast, FishingWait, FishingReel } public enum CellAttribute : byte { Walk = 0, HighWall = 1, LowWall = 2, } public enum LightSetting : byte { Normal = 0, Dawn = 1, Day = 2, Evening = 3, Night = 4 } [Obfuscation(Feature = "renaming", Exclude = true)] public enum MirGender : byte { Male = 0, Female = 1 } [Obfuscation(Feature = "renaming", Exclude = true)] public enum MirClass : byte { Warrior = 0, Wizard = 1, Taoist = 2, Assassin = 3, Archer = 4 } public enum MirDirection : byte { Up = 0, UpRight = 1, Right = 2, DownRight = 3, Down = 4, DownLeft = 5, Left = 6, UpLeft = 7 } public enum ObjectType : byte { None = 0, Player = 1, Item = 2, Merchant = 3, Spell = 4, Monster = 5, Deco = 6, Creature = 7 } public enum ChatType : byte { Normal = 0, Shout = 1, System = 2, Hint = 3, Announcement = 4, Group = 5, WhisperIn = 6, WhisperOut = 7, Guild = 8, Trainer = 9, LevelUp = 10, System2 = 11, Relationship = 12, Mentor = 13, Shout2 = 14, Shout3 = 15, AutoBoss = 16, AutoItem = 17, ItemNoice = 18, Grade3=19, Grade4=20 } public enum ItemType : byte { Nothing = 0, Weapon = 1, Armour = 2, Helmet = 4, Necklace = 5, Bracelet = 6, Ring = 7, Amulet = 8, Belt = 9, Boots = 10, Stone = 11, Torch = 12, Potion = 13, Ore = 14, Meat = 15, CraftingMaterial = 16, Scroll = 17, Gem = 18, Mount = 19, Book = 20, Script = 21, Reins = 22, Bells = 23, Saddle = 24, Ribbon = 25, Mask = 26, Food = 27, Hook = 28, Float = 29, Bait = 30, Finder = 31, Reel = 32, Fish = 33, Quest = 34, Awakening = 35, Pets = 36, Transform = 37, Recipe = 38, Treasure=39 //宝箱礼盒 } public enum MirGridType : byte { None = 0, Inventory = 1, Equipment = 2, Trade = 3, Storage = 4, BuyBack = 5, DropPanel = 6, Inspect = 7, TrustMerchant = 8, GuildStorage = 9, GuestTrade = 10, Mount = 11, Fishing = 12, QuestInventory = 13, AwakenItem = 14, Mail = 15, Refine = 16, UnAwakenItem = 17, MailShow = 18, GameShop=19, Taobao=20, TrustMerchantSign=21, MACUpgrade=22 } public enum EquipmentSlot : byte { Weapon = 0, Armour = 1, Helmet = 2, Torch = 3, Necklace = 4, BraceletL = 5, BraceletR = 6, RingL = 7, RingR = 8, Amulet = 9, Belt = 10, Boots = 11, Stone = 12, Mount = 13 } public enum MountSlot : byte { Reins = 0, Bells = 1, Saddle = 2, Ribbon = 3, Mask = 4 } public enum FishingSlot : byte { Hook = 0, Float = 1, Bait = 2, Finder = 3, Reel = 4 } [Obfuscation(Feature = "renaming", Exclude = true)] public enum AttackMode : byte { Peace = 0, Group = 1, Guild = 2, EnemyGuild = 3, RedBrown = 4, All = 5 } [Obfuscation(Feature = "renaming", Exclude = true)] public enum PetMode : byte { Both = 0, MoveOnly = 1, AttackOnly = 2, None = 3, } [Flags] [Obfuscation(Feature = "renaming", Exclude = true)] public enum PoisonType : ushort { None = 0, Green = 1, Red = 2, Curse = 3, Slow = 4, Frozen = 8, Stun = 16, Paralysis = 32, DelayedExplosion = 64, Bleeding = 128, LRParalysis = 256 } [Flags] [Obfuscation(Feature = "renaming", Exclude = true)] public enum BindMode : short { none = 0, DontDeathdrop = 1,//0x0001 DontDrop = 2,//0x0002 DontSell = 4,//0x0004 DontStore = 8,//0x0008 DontTrade = 16,//0x0010 DontRepair = 32,//0x0020 DontUpgrade = 64,//0x0040 DestroyOnDrop = 128,//0x0080 BreakOnDeath = 256,//0x0100 BindOnEquip = 512,//0x0200 NoSRepair = 1024,//0x0400 NoWeddingRing = 2048,//0x0800 MustDrop = 4096,//0X1000 } [Flags] [Obfuscation(Feature = "renaming", Exclude = true)] public enum MakeMode { NODamaged = 0, Ordinary = 1, Perfect = 2, Luminous = 4, } [Flags] [Obfuscation(Feature = "renaming", Exclude = true)] public enum SpecialItemMode : short { None = 0, Paralize = 0x0001, Teleport = 0x0002, Clearring = 0x0004, Protection = 0x0008, Revival = 0x0010, Muscle = 0x0020, Flame = 0x0040, Healing = 0x0080, Probe = 0x0100, Skill = 0x0200, NoDuraLoss = 0x0400, } [Flags] [Obfuscation(Feature = "renaming", Exclude = true)] public enum RequiredClass : byte { Warrior = 1, Wizard = 2, Taoist = 4, Assassin = 8, Archer = 16, WarWizTao = Warrior | Wizard | Taoist, None = WarWizTao | Assassin | Archer } [Flags] [Obfuscation(Feature = "renaming", Exclude = true)] public enum RequiredGender : byte { Male = 1, Female = 2, None = Male | Female } [Obfuscation(Feature = "renaming", Exclude = true)] public enum RequiredType : byte { Level = 0, AC = 1, MAC = 2, DC = 3, MC = 4, SC = 5, } //[Obfuscation(Feature = "renaming", Exclude = true)] //public enum ItemSet : byte //{ // None = 0, // Spirit = 1, // Recall = 2, // RedOrchid = 3, // RedFlower = 4, // Smash = 5, // HwanDevil = 6, // Purity = 7, // FiveString = 8, // Mundane = 9, // NokChi = 10, // TaoProtect = 11, // Mir = 12, // Bone = 13, // Bug = 14, // WhiteGold = 15, // WhiteGoldH = 16, // RedJade = 17, // RedJadeH = 18, // Nephrite = 19, // NephriteH = 20, // Whisker1 = 21, // Whisker2 = 22, // Whisker3 = 23, // Whisker4 = 24, // Whisker5 = 25, // Hyeolryong = 26, // Monitor = 27, // Oppressive = 28, // Paeok = 29, // Sulgwan = 30, // 虹膜 = 31, // 魔血 = 32, // 金刚 = 33, // 魔令 = 34, // 祈祷 = 35, // 诺玛 = 36, // 祖玛战 = 37, // 祖玛法 = 38, // 祖玛道 = 39, // 诺玛火 = 40, // 诺玛冰 = 41, // 诺玛风 = 42, // 诺玛电 = 43, // 诺玛神圣 = 44, // 诺玛暗黑 = 45, // 诺玛幻影 = 46, //} [Obfuscation(Feature = "renaming", Exclude = true)] public enum Spell : byte { None = 0, 基本剑术 = 1,//基本剑术 攻杀剑术 = 2,//Slaying 刺杀剑术 = 3,//Thrusting 半月弯刀 = 4,//HalfMoon 野蛮冲撞 = 5,//ShoulderDash //双龙斩 = 6,//TwinDrakeBlade 莲月剑法 = 6,//TwinDrakeBlade 捕绳剑 = 7,//Entrapment 烈火剑法 = 8,//FlamingSword 狮子吼 = 9,//LionRoar //狂风斩 = 10,//CrossHalfMoon 十方斩 = 10,//CrossHalfMoon 空破闪 = 11,//BladeAvalanche //护身气幕 = 12,//ProtectionField 铁布衫 = 12,//ProtectionField // 剑气爆 = 13,//Rage 破血狂杀 = 13,//Rage 天务 = 14,//CounterAttack 日闪 = 15,//SlashingBurst 血龙剑法 = 16,//Fury 金刚不坏 = 17,//ImmortalSkin 翔空剑法 = 18, //Swordsle 斗转星移 = 19, //PassingNight 乾坤大挪移 = 20, //HellMoving //Wizard 火球术 = 31,//FireBall //OK 抗拒火环 = 32,//Repulsion 诱惑之光 = 33,//ElectricShock 大火球 = 34,//GreatFireBall //OK 地狱火 = 35,//HellFire //OK 雷电术 = 36,//ThunderBolt 瞬息移动 = 37,//Teleport 爆裂火焰 = 38,//FireBang //OK 火墙 = 39,//FireWall //OK 疾光电影 = 40,//Lightning 冰月神掌 = 41,//FrostCrunch 地狱雷光 = 42,//ThunderStorm 魔法盾 = 43,//MagicShield 圣言术 = 44,//TurnUndead 噬血术 = 45,//Vampirism 冰咆哮 = 46,//IceStorm 灭天火 = 47,//FlameDisruptor 分身术 = 48,//Mirroring 火龙气焰 = 49,//FlameField 天霜冰环 = 50,//Blizzard 凝血离魂 = 51,//MagicBooster 天上落焰 = 52,//MeteorStrike 冰焰术 = 53,//IceThrust FastMove = 54,//FastMove StormEscape = 55,//StormEscape 焰天火雨 = 56, //FlameRain 冰月震天 = 57, //IceMoon 冰沙掌 = 58, //IceMpalms 魄冰刺 = 59, //PiercSpines 风掌 = 60, //Windpalms 击风 = 161, //WindBlow 风震天 = 162, //WindEarth 龙卷风 = 163, //WindTornado 霹雳掌 = 164, //Thunderpalms 怒神霹雳 = 165, //ThunderClap 移行换位 = 151,//Blink //Taoist 治愈术 = 61,//Healing 精神力战法 = 62,//SpiritSword 施毒术 = 63,//Poisoning 灵魂火符 = 64,//SoulFireBall 召唤骷髅 = 65,//SummonSkeleton 隐身术 = 67,//Hiding 集体隐身术 = 68,//MassHiding 幽灵盾 = 69,//SoulShield 心灵启示 = 70,//Revelation 神圣战甲术 = 71,//BlessedArmour 气功波 = 72,//EnergyRepulsor 困魔咒 = 73,//TrapHexagon 云寂术 = 74,//Purification 群体治疗术 = 75,//MassHealing 迷魂术 = 76,//Hallucination 无极真气 = 77,//UltimateEnhancer 召唤神兽 = 78,//SummonShinsu 回生术 = 79,//Reincarnation 超强召唤骷髅 = 80,//SummonHolyDeva 诅咒术 = 81,//Curse 烦恼 = 82,//Plague 毒云 = 83,//PoisonCloud 阴阳法环 = 84,//EnergyShield 移花接玉 = 85,//PetEnhancer 阴阳五行阵 = 86, //HealingCircle 月魂断玉 = 87, //BrokenJade 月魂灵波 = 88, //BrokenWavezx 强魔震法 = 89,//MagicShock 猛虎强势 = 90,//TigerStrong 妙影无踪 = 166, //GoodShadow 空拳刀法 = 167, //EmptyFist //Assassin 绝命剑法 = 91,//FatalSword 风剑术 = 92,//DoubleSlash 体迅风 = 93,//Haste 拔刀术 = 94,//FlashDash 风身术 = 95,//LightBody 迁移剑 = 96,//HeavenlySword 烈风击 = 97,//FireBurst 捕缚术 = 98,//Trap 猛毒剑气 = 99,//PoisonSword 月影术 = 100,//MoonLight 吸气 = 101,//MPEater 轻身步 = 102,//SwiftFeet 烈火身 = 103,//DarkBody 血风击 = 104,//Hemorrhage 月华乱舞 = 105,//CrescentSlash MoonMist = 106,//MoonMist //Archer 必中闪 = 121,//Focus 天日闪 = 122,//StraightShot 无我闪 = 123,//DoubleShot 爆阱 = 124,//ExplosiveTrap 爆闪 = 125,//DelayedExplosion 气功术 = 126,//Meditation 风弹步 = 127,//BackStep 万斤闪 = 128,//ElementalShot 气流术 = 129,//Concentration 金刚术 = 130,//Stonetrap 元素护盾 = 131,//ElementalBarrier 吸血地精 = 132,//SummonVampire 吸血地闪 = 133,//VampireShot 痹魔阱 = 134,//SummonToad 毒魔闪 = 135,//PoisonShot 邪爆闪 = 136,//CrippleShot 蛇柱阱 = 137,//SummonSnakes 血龙闪 = 138,//NapalmShot 血龙闪秘籍 = 139,//OneWithNature 地柱钉 = 140,//BindingShot 精神状态 = 141,//MentalState //Custom 空间转移 = 152,//Portal // //Map Events DigOutZombie = 200,// Rubble = 201,// MapLightning = 202,// MapLava = 203,// MapQuake1 = 204,// MapQuake2 = 205// } public enum SpellEffect : byte { None, FatalSword, Teleport, Healing, RedMoonEvil, TwinDrakeBlade, MagicShieldUp, MagicShieldDown, GreatFoxSpirit, Entrapment, Reflect, Critical, Mine, ElementalBarrierUp, ElementalBarrierDown, DelayedExplosion, MPEater, Hemorrhage, Bleeding, AwakeningSuccess, AwakeningFail, AwakeningMiss, AwakeningHit, StormEscape, TurtleKing, Behemoth, Stunned, IcePillar } public enum BuffType : byte { None = 0, //magics TemporalFlux, Hiding, GoodShadow, Haste, SwiftFeet, Fury, SoulShield, BlessedArmour, MagicShock, TigerStrong, LightBody, UltimateEnhancer, ProtectionField, Rage, WeakCurse, Curse, MoonLight, DarkBody, Concentration, VampireShot, PoisonShot, CounterAttack, MentalState, EnergyShield, MagicBooster, PetEnhancer, ImmortalSkin, MagicShield, //special GameMaster = 100, General, Exp, Drop, Gold, BagWeight, Transform, RelationshipEXP, Mentee, Mentor, Guild, Prison, Rested, GroupHp, PowerBlessing, Impact = 200, Magic, Taoist, Storm, HealthAid, ManaAid, Defence, MagicDefence, WonderDrug, Knapsack, AutoGetItem, AutoBoss, AutoShowItem, PetMaster, LuckProtector, LadyBlessing, NewGuildEXP, } public enum DefenceType : byte { ACAgility, AC, MACAgility, MAC, Agility, Repulsion, None } // 1-30000 客户包 30001-60000 服务包 60000-65535 通讯包 public enum ServerPacketIds : ushort { ClientVersion = 30001, Disconnect, KeepAlive, HookSuspicionMsg, HookSuspicionMsgFailure, Connected, EnterAlive, NewAccount, ChangePassword, ChangePasswordBanned, Login, LoginAccount, LoginBanned, LoginSuccess, NewCharacter, NewCharacterSuccess, DeleteCharacter, DeleteCharacterSuccess, StartGame, StartGameBanned, StartGameDelay, MapInformation, UserInformation, UserLocation, ObjectPlayer, ObjectRemove, ObjectTurn, ObjectWalk, ObjectRun, Chat, ObjectChat, NewItemInfo, MoveItem, EquipItem, MergeItem, RemoveItem, RemoveSlotItem, TakeBackItem, StoreItem, SureBuyStorage, StorPasswordAuthResult, ReceiveMessageBox, SetStoragePassword, StorPasswordAsk, SplitItem, SplitItem1, DepositRefineItem, RetrieveRefineItem, RefineCancel, RefineItem, Mir3RefineItem, ClientHP, Mir3AtkRefine, FindBlackItem, DepositTradeItem, RetrieveTradeItem, UseItem, DropItem, PlayerUpdate, PlayerInspect, LogOutSuccess, LogOutFailed, TimeOfDay, ChangeAMode, ChangePMode, ObjectItem, ObjectUseItem, DropProtectSuccess, ObjectGold, GainedItem, GainedGold, LoseGold, GainedCredit, LoseCredit, ObjectMonster, ObjectAttack, Struck, ObjectStruck, DamageIndicator, DuraChanged, PoisonChangaChanged, HealthChanged, DeleteItem, Death, ObjectDied, ColorChanged, ObjectColorChanged, ObjectGuildNameChanged, GainExperience, SubExperience, LevelChanged, ExtraChanged, ObjectLeveled, ObjectWpLeveled, ObjectShowHelmet, ObjectHarvest, ObjectHarvested, ObjectNpc, QueryMapNPCs, QueryAllMaps, NPCResponse, ObjectHide, ObjectShow, Poisoned, ObjectPoisoned, MapChanged, ObjectTeleportOut, ObjectTeleportIn, TeleportIn, NPCGoods, NPCSelectGoods, NPCSell, NPCRepair, NPCSRepair, NPCRefine, NPCCheckRefine, NPCCollectRefine, NPCReplaceWedRing, NPCStorage, StartMACUpgrade, ClearMACUpgrade, MACUpgradeResult, SellItem, RepairItem, ItemRepaired, NewMagic, RemoveMagic, MagicLeveled, Magic, MagicDelay, MagicCast, ObjectMagic, ObjectEffect, RangeAttack, Pushed, ObjectPushed, ObjectName, UserStorage, SwitchGroup, DeleteGroup, DeleteMember, MemberLocation, GroupInvite, AddMember, Revived, ObjectRevived, SpellToggle, ObjectHealth, MapEffect, ObjectRangeAttack, AddBuff, RemoveBuff, ObjectHidden, ObjectSpHidden, RefreshItem, RefreshHair, ObjectRefreshHair, ObjectSpell, UserDash, ObjectDash, UserDashFail, ObjectDashFail, NPCConsign, NPCMarket, ZanZhuChangeName, AuctionGroups, GameShopSearch, ItemProtectStart, ExchangeConfigSearch, ItemAuctionSearch, MyAuctionSearch, // GNPCMarket, NPCMarketPage, ConsignItem, MarketFail, MarketSuccess, ObjectSitDown, RefreshSeasonExitTime, InTrapRock, BaseStatsInfo, UserName, ChatItemStats, GuildNoticeChange, GuildMemberChange, GuildStatus, GetAllGuild, GetAllJoinRequest, GuildInvite, GuildExpGain, GuildNameRequest, GuildStorageGoldChange, GuildStorageItemChange, GuildStorageList, GuildRequestWar, DefaultNPC, NPCUpdate, MarriageRequest, DivorceRequest, MentorRequest, TradeRequest, TradeAccept, TradeGold, TradeItem, TradeCost, TradeConfirm, TradeCancel, MountUpdate, EquipSlotItem, FishingUpdate, ChangeQuest, CompleteQuest, ShareQuest, NewQuestInfo, GainedQuestItem, DeleteQuestItem, CancelReincarnation, RequestReincarnation, UserBackStep, ObjectBackStep, UserDashAttack, ObjectDashAttack, UserAttackMove, CombineItem, ItemUpgraded, SetConcentration, SetObjectConcentration, SetElemental, SetObjectElemental, RemoveDelayedExplosion, ObjectDeco, ObjectSneaking, ObjectLevelEffects, SetBindingShot, SendOutputMessage, NPCAwakening, NPCDisassemble, NPCDowngrade, NPCReset, AwakeningNeedMaterials, DropProtectNeedMaterials, AwakeningLockedItem, Awakening, ReceiveMail, MailLockedItem, MailSendRequest, MailSent, ParcelCollected, MailCost, ResizeInventory, NewIntelligentCreature, UpdateIntelligentCreatureList, IntelligentCreatureEnableRename, IntelligentCreaturePickup, NPCPearlGoods, TransformUpdate, FriendUpdate, FriendRequest, LoverUpdate, MentorUpdate, GuildBuffList, NPCRequestInput, GameShopInfo, GameShopStock, Rankings, Opendoor, ReshRecipes, AboutToQuest, ServerArea, NPCUnAwaken, NPCDocument, NPCUnAwakening, UnAwakening, OpenJyxt, InitialItem, MoveShield, } public enum ClientPacketIds : ushort { ClientVersion = 1, Disconnect, KeepAlive, EnterAlive, NewAccount, ChangePassword, Login, LoginAccount, NewCharacter, DeleteCharacter, StartGame, LogOut, Turn, Walk, Run, Chat, MoveItem, StoreItem, SendStorPassword, SetStorPassword, CancelPassword, BuyStorage, UseHorn, TakeBackItem, MergeItem, EquipItem, RemoveItem, RemoveSlotItem, SplitItem, UseItem, DropItem, DepositRefineItem, RetrieveRefineItem, RefineCancel, RefineItem, CheckRefine, ReplaceWedRing, DepositTradeItem, RetrieveTradeItem, DropGold, PickUp, Inspect, ChangeAMode, ChangePMode, ChangeTrade, ChangeHelmetoff, Attack, RangeAttack, Harvest, CallNPC, TalkMonsterNPC, BuyItem, GetSelectItem, SellItem, RepairItem, BuyItemBack, FindItem, PoisonChangaChanged, SRepairItem, MagicKey, Magic, SwitchGroup, AddMember, DellMember, GroupInvite, TownRevive, SpellToggle, ConsignItem, MarketSearch, MarketSearch2, ItemAuctionSearch, MyAuctionSearch, MarketGroupSearch, GameShopSearch, ExchangeSend, MACUpgradeSend, ClearMACUpgradeSend, DropProtectUpgradeSend, BuyGameShopItem, MarketRefresh, MarketPage, MarketBuy, MarketGetBack, RequestUserName, RequestChatItem, HookQuestionRespose, EditGuildMember, GetAllGuild, GetAllJoinRequest, ResposeJoinGuild, RequestJoinGuild, EditGuildNotice, GuildInvite, GuildNameReturn, RequestGuildInfo, GuildStorageGoldChange, GuildStorageItemChange, GuildWarReturn, MarriageRequest, MarriageReply, ChangeMarriage, ChangeName, DivorceRequest, DivorceReply, AddMentor, MentorReply, AllowMentor, CancelMentor, TradeRequest, TradeReply, TradeGold, TradeConfirm, TradeCancel, EquipSlotItem, FishingCast, FishingChangeAutocast, AcceptQuest, FinishQuest, AbandonQuest, ShareQuest, AcceptReincarnation, CancelReincarnation, CombineItem, SetConcentration, AwakeningNeedMaterials, DropProtectNeedMaterials, AwakeningLockedItem, Awakening, DisassembleItem, DowngradeAwakening, ResetAddedItem, SendMail, ReadMail, CollectParcel, DeleteMail, LockMail, MailLockedItem, MailCost, GetAllhp, UpdateIntelligentCreature, IntelligentCreaturePickup, AddFriend, AddFriendRespose, RemoveFriend, RefreshFriends, AddMemo, GuildBuffUpdate, NPCConfirmInput, QueryMapNPCs, QueryAllMaps, GameshopBuy, ReportIssue, GetRanking, Opendoor, PayMail, RefreshRecipe, VersionName, UnAwakening, InitialItem, MoveShield, PrepareMoveShield, } public enum CustomPacketIds : ushort { Manager = 60001, } public enum ConquestType : byte { Request = 0, Auto = 1, Forced = 2, } public enum ConquestGame : byte { CapturePalace = 0, KingOfHill = 1, Random = 2, Classic = 3, } public class InIReader { #region Fields private readonly List _contents; private readonly string _fileName; #endregion #region Constructor public InIReader(string fileName) { _fileName = fileName; _contents = new List(); try { if (File.Exists(_fileName)) _contents.AddRange(File.ReadAllLines(_fileName)); } catch { } } #endregion #region Functions private string FindValue(string section, string key) { for (int a = 0; a < _contents.Count; a++) if (String.CompareOrdinal(_contents[a], "[" + section + "]") == 0) for (int b = a + 1; b < _contents.Count; b++) if (String.CompareOrdinal(_contents[b].Split('=')[0], key) == 0) return _contents[b].Split('=')[1]; else if (_contents[b].StartsWith("[") && _contents[b].EndsWith("]")) return null; return null; } private int FindIndex(string section, string key) { for (int a = 0; a < _contents.Count; a++) if (String.CompareOrdinal(_contents[a], "[" + section + "]") == 0) for (int b = a + 1; b < _contents.Count; b++) if (String.CompareOrdinal(_contents[b].Split('=')[0], key) == 0) return b; else if (_contents[b].StartsWith("[") && _contents[b].EndsWith("]")) { _contents.Insert(b - 1, key + "="); return b - 1; } else if (_contents.Count - 1 == b) { _contents.Add(key + "="); return _contents.Count - 1; } if (_contents.Count > 0) _contents.Add(""); _contents.Add("[" + section + "]"); _contents.Add(key + "="); return _contents.Count - 1; } public void Save() { try { File.WriteAllLines(_fileName, _contents); } catch { } } #endregion #region Read public bool ReadBoolean(string section, string key, bool Default) { bool result; if (!bool.TryParse(FindValue(section, key), out result)) { result = Default; Write(section, key, Default); } return result; } public byte ReadByte(string section, string key, byte Default) { byte result; if (!byte.TryParse(FindValue(section, key), out result)) { result = Default; Write(section, key, Default); } return result; } public sbyte ReadSByte(string section, string key, sbyte Default) { sbyte result; if (!sbyte.TryParse(FindValue(section, key), out result)) { result = Default; Write(section, key, Default); } return result; } public ushort ReadUInt16(string section, string key, ushort Default) { ushort result; if (!ushort.TryParse(FindValue(section, key), out result)) { result = Default; Write(section, key, Default); } return result; } public short ReadInt16(string section, string key, short Default) { short result; if (!short.TryParse(FindValue(section, key), out result)) { result = Default; Write(section, key, Default); } return result; } public uint ReadUInt32(string section, string key, uint Default) { uint result; if (!uint.TryParse(FindValue(section, key), out result)) { result = Default; Write(section, key, Default); } return result; } public int ReadInt32(string section, string key, int Default) { int result; if (!int.TryParse(FindValue(section, key), out result)) { result = Default; Write(section, key, Default); } return result; } public ulong ReadUInt64(string section, string key, ulong Default) { ulong result; if (!ulong.TryParse(FindValue(section, key), out result)) { result = Default; Write(section, key, Default); } return result; } public long ReadInt64(string section, string key, long Default) { long result; if (!long.TryParse(FindValue(section, key), out result)) { result = Default; Write(section, key, Default); } return result; } public float ReadSingle(string section, string key, float Default) { float result; if (!float.TryParse(FindValue(section, key), out result)) { result = Default; Write(section, key, Default); } return result; } public double ReadDouble(string section, string key, double Default) { double result; if (!double.TryParse(FindValue(section, key), out result)) { result = Default; Write(section, key, Default); } return result; } public decimal ReadDecimal(string section, string key, decimal Default) { decimal result; if (!decimal.TryParse(FindValue(section, key), out result)) { result = Default; Write(section, key, Default); } return result; } public string ReadString(string section, string key, string Default) { string result = FindValue(section, key); if (string.IsNullOrEmpty(result)) { result = Default; Write(section, key, Default); } return result; } public char ReadChar(string section, string key, char Default) { char result; if (!char.TryParse(FindValue(section, key), out result)) { result = Default; Write(section, key, Default); } return result; } public Point ReadPoint(string section, string key, Point Default) { string temp = FindValue(section, key); int tempX, tempY; if (temp == null || !int.TryParse(temp.Split(',')[0], out tempX)) { Write(section, key, Default); return Default; } if (!int.TryParse(temp.Split(',')[1], out tempY)) { Write(section, key, Default); return Default; } return new Point(tempX, tempY); } public Size ReadSize(string section, string key, Size Default) { string temp = FindValue(section, key); int tempX, tempY; if (!int.TryParse(temp.Split(',')[0], out tempX)) { Write(section, key, Default); return Default; } if (!int.TryParse(temp.Split(',')[1], out tempY)) { Write(section, key, Default); return Default; } return new Size(tempX, tempY); } public TimeSpan ReadTimeSpan(string section, string key, TimeSpan Default) { TimeSpan result; if (!TimeSpan.TryParse(FindValue(section, key), out result)) { result = Default; Write(section, key, Default); } return result; } public float ReadFloat(string section, string key, float Default) { float result; if (!float.TryParse(FindValue(section, key), out result)) { result = Default; Write(section, key, Default); } return result; } #endregion #region Write public void Write(string section, string key, bool value) { _contents[FindIndex(section, key)] = key + "=" + value; Save(); } public void Write(string section, string key, byte value) { _contents[FindIndex(section, key)] = key + "=" + value; Save(); } public void Write(string section, string key, sbyte value) { _contents[FindIndex(section, key)] = key + "=" + value; Save(); } public void Write(string section, string key, ushort value) { _contents[FindIndex(section, key)] = key + "=" + value; Save(); } public void Write(string section, string key, short value) { _contents[FindIndex(section, key)] = key + "=" + value; Save(); } public void Write(string section, string key, uint value) { _contents[FindIndex(section, key)] = key + "=" + value; Save(); } public void Write(string section, string key, int value) { _contents[FindIndex(section, key)] = key + "=" + value; Save(); } public void Write(string section, string key, ulong value) { _contents[FindIndex(section, key)] = key + "=" + value; Save(); } public void Write(string section, string key, long value) { _contents[FindIndex(section, key)] = key + "=" + value; Save(); } public void Write(string section, string key, float value) { _contents[FindIndex(section, key)] = key + "=" + value; Save(); } public void Write(string section, string key, double value) { _contents[FindIndex(section, key)] = key + "=" + value; Save(); } public void Write(string section, string key, decimal value) { _contents[FindIndex(section, key)] = key + "=" + value; Save(); } public void Write(string section, string key, string value) { _contents[FindIndex(section, key)] = key + "=" + value; Save(); } public void Write(string section, string key, char value) { _contents[FindIndex(section, key)] = key + "=" + value; Save(); } public void Write(string section, string key, Point value) { _contents[FindIndex(section, key)] = key + "=" + value.X + "," + value.Y; Save(); } public void Write(string section, string key, Size value) { _contents[FindIndex(section, key)] = key + "=" + value.Width + "," + value.Height; Save(); } public void Write(string section, string key, TimeSpan value) { _contents[FindIndex(section, key)] = key + "=" + value; Save(); } #endregion } public static class Globals { public const int MinAccountIDLength = 3, MaxAccountIDLength = 10, MinPasswordLength = 5, MaxPasswordLength = 12, MinCharacterNameLength = 2, MaxCharacterNameLength = 8, MaxCharacterCount = 4, MaxChatLength = 80, MaxGroup = 15, MaxAttackRange = 9, MaxDragonLevel = 13, FlagIndexCount = 999, MaxConcurrentQuests = 20, LogDelay = 0, DataRange = 16;//Was 24 public static float Commission = 0.05F; public const uint SearchDelay = 500, ConsignmentLength = 7, ConsignmentCost = 5000, MinConsignment = 10, MaxConsignment = 99999999; public static ushort[,] HpLevel = { {21,26,33,41,48,57,66,76,87,98,110,122,135,150,164,179,195,211,229,246,265,284,304,325,345,367,389,413,437,461,486,512,538,565,593,622,650,680,711,741,773,805,838,872,906,942,977,1013,1051,1090,1130,1170,1210,1250,1290,1330,1370,1410,1450,1490}, {22,25,28,31,35,38,42,46,50,55,59,63,69,73,78,84,90,95,101,108,113,120,127,134,141,148,155,164,171,179,188,196,204,213,223,231,241,251,260,270,280,290,301,311,322,333,344,356,367,379,391,403,415,427,439,451,463,475,487,499}, {19,22,25,30,34,39,44,50,55,62,68,75,83,90,98,107,116,124,134,144,154,165,176,187,199,211,223,237,250,263,277,292,306,321,337,352,369,385,402,419,437,454,473,492,510,530,550,570,591,612,633,654,675,696,717,738,759,780,801,822} }; public static ushort[,] MpLevel = { {17,20,24,28,32,35,40,43,47,51,55,58,63,66,70,74,78,81,86,89,94,97,101,105,109,112,117,120,124,128,132,135,140,143,147,151,155,158,163,166,171,174,178,182,186,189,194,197,201,205,209,213,217,221,225,229,234,239,244,249}, {21,28,35,44,53,63,75,87,101,116,132,148,167,185,205,225,247,270,293,319,344,371,399,428,458,489,521,553,588,622,658,695,733,772,812,853,895,938,982,1027,1073,1120,1168,1217,1267,1318,1371,1424,1478,1533,1588,1643,1698,1753,1808,1863,1918,1973,2028,2083}, {14,15,17,19,22,25,29,34,39,45,51,58,65,74,83,91,101,112,123,135,147,161,174,188,204,219,234,252,268,287,305,325,343,364,385,406,428,451,474,498,523,548,573,600,627,655,682,712,740,771,802,833,864,895,926,957,988,1019,1050,1081} }; public static uint[] WpLevelExp ={ 60000, 60000, 60000, 90000, 90000, 90000, 90000, 120000, 120000, 120000, 120000,150000, 150000, 150000, 150000, 180000, 420000, 420000, 420000, 480000, 480000, 480000, 480000, 540000, 540000, 540000, 540000, 600000, 600000, 600000, 600000, 660000, 660000, 660000, 660000, 720000 }; public static Color[] EIColor = { Color.White, Color.FromArgb(255, 240, 180, 100), Color.FromArgb(255, 100, 140, 190), Color.FromArgb(255, 140, 200, 150), Color.FromArgb(255, 50, 70, 200), Color.FromArgb(255, 200, 200, 200), Color.FromArgb(255, 160, 100, 180), Color.FromArgb(255, 200, 220, 130), }; public static string[] OrdMystery = { "神秘头盔(普通)", "神秘战戒(普通)", "神秘法戒(普通)", "神秘道戒(普通)", "神秘战镯(普通)", "神秘法镯(普通)", "神秘道镯(普通)", "神秘战链(普通)", "神秘法链(普通)", "神秘道链(普通)"}; public static string[] SenMystery = { "神秘头盔(高级)", "神秘战戒(高级)", "神秘法戒(高级)", "神秘道戒(高级)", "神秘战镯(高级)", "神秘法镯(高级)", "神秘道镯(高级)", "神秘战链(高级)", "神秘法链(高级)", "神秘道链(高级)"}; //保存到数据库的BUFF类型 public static BuffType[] SaveBuff = { BuffType.Drop , BuffType.Exp, BuffType.General, BuffType.Transform, BuffType.Impact, BuffType.Magic, BuffType.Taoist, BuffType.Storm, BuffType.HealthAid, BuffType.ManaAid, BuffType.Defence, BuffType.MagicDefence, BuffType.LuckProtector, BuffType.Rested, BuffType.PowerBlessing, BuffType.LadyBlessing }; public static int[] RefinProemolecule = { 500, 100, 20, 5, 5, 3,2,2,2 }; public static int[] NotRefinIndex = { }; public static List Magicelevelps = LoadMagicelevelps(); public static void SaveMagicelevelps() { File.WriteAllText("./Configs/Magicelevelps.json", JsonConvert.SerializeObject(Magicelevelps)); } public static List LoadMagicelevelps() { if (File.Exists("./Configs/Magicelevelps.json")) { var str = File.ReadAllText("./Configs/Magicelevelps.json"); return JsonConvert.DeserializeObject>(str); } else { return new List() ; } } public static ExtraDamageItem[] DamageItems = { new ExtraDamageItem { // 黑天暗云 自然系魔法伤害加成 20% // type; 1 物理攻击伤害加成 2 自然系魔法伤害加成 3 灵魂系魔法伤害加成 4 攻击双倍伤害 Rate 表示概率 5 灵魂系魔法伤害双倍 Rate 表示概率 6 反弹所收到的5%魔法和物理伤害回敬给对方 106 施加3级施毒术的绿毒效果 Type = 2, ItemIndex=1018, Rate=0.2 }, new ExtraDamageItem { // 九宫云雾:10%魔法躲避 有14份之一的概率灵魂系攻击双倍伤害 ItemIndex=1019, Type=4, Rate=1.0/14.0 }, new ExtraDamageItem { // 万里碧海:10%暴击几率 有14份之一的概率攻击双倍伤害 ItemIndex=1020, Type=4, Rate=1.0/14.0 }, new ExtraDamageItem { // 血花落照:反弹所收到的魔法和物理伤害回敬给对方 ItemIndex=1017, Type=6, Rate=0.05 } }; public static SpecialEffectItem[] SpecialEffects = { new SpecialEffectItem { // 血花落照:15%几率给人或怪施加3级施毒术的绿毒效果 ItemIndex=1017, Type=106, Rate=0.15 } }; public static string[] AmulTtpye = { "普通符", "火符", "冰符", "风符", "雷符", "神圣", "暗黑", "幻影",}; } public static class Functions { /// /// 时间戳转为C#格式时间 /// /// Unix时间戳格式 /// C#格式时间 public static DateTime GetTime(string timeStamp) { DateTime dtStart = TimeZone.CurrentTimeZone.ToLocalTime(new DateTime(1970, 1, 1)); long lTime = long.Parse(timeStamp + "0000000"); TimeSpan toNow = new TimeSpan(lTime); return dtStart.Add(toNow); } /// /// DateTime时间格式转换为Unix时间戳格式 /// /// DateTime时间格式 /// Unix时间戳格式 public static int ConvertDateTimeInt(System.DateTime time) { System.DateTime startTime = TimeZone.CurrentTimeZone.ToLocalTime(new System.DateTime(1970, 1, 1)); return (int)(time - startTime).TotalSeconds; } public static bool CompareBytes(byte[] a, byte[] b) { if (a == b) return true; if (a == null || b == null || a.Length != b.Length) return false; for (int i = 0; i < a.Length; i++) if (a[i] != b[i]) return false; return true; } public static bool TryParse(string s, out Point temp) { temp = Point.Empty; int tempX, tempY; if (String.IsNullOrWhiteSpace(s)) return false; string[] data = s.Split(','); if (data.Length <= 1) return false; if (!Int32.TryParse(data[0], out tempX)) return false; if (!Int32.TryParse(data[1], out tempY)) return false; temp = new Point(tempX, tempY); return true; } public static Point Subtract(this Point p1, Point p2) { return new Point(p1.X - p2.X, p1.Y - p2.Y); } public static Point Subtract(this Point p1, int x, int y) { return new Point(p1.X - x, p1.Y - y); } public static Point Add(this Point p1, Point p2) { return new Point(p1.X + p2.X, p1.Y + p2.Y); } public static Point Add(this Point p1, int x, int y) { return new Point(p1.X + x, p1.Y + y); } public static string PointToString(Point p) { return String.Format("{0}, {1}", p.X, p.Y); } public static bool InRange(Point a, Point b, int i) { return Math.Abs(a.X - b.X) <= i && Math.Abs(a.Y - b.Y) <= i; } public static bool FacingEachOther(MirDirection dirA, Point pointA, MirDirection dirB, Point pointB) { if (dirA == DirectionFromPoint(pointA, pointB) && dirB == DirectionFromPoint(pointB, pointA)) { return true; } return false; } public static string PrintTimeSpanFromSeconds(double secs, bool accurate = true) { TimeSpan t = TimeSpan.FromSeconds(secs); string answer; if (t.TotalMinutes < 1.0) { answer = string.Format("{0}s", t.Seconds); } else if (t.TotalHours < 1.0) { answer = accurate ? string.Format("{0}m {1:D2}s", t.Minutes, t.Seconds) : string.Format("{0}m", t.Minutes); } else if (t.TotalDays < 1.0) { answer = accurate ? string.Format("{0}h {1:D2}m {2:D2}s", (int)t.Hours, t.Minutes, t.Seconds) : string.Format("{0}h {1:D2}m", (int)t.TotalHours, t.Minutes); } else // more than 1 day { answer = accurate ? string.Format("{0}d {1:D2}h {2:D2}m {3:D2}s", (int)t.Days, (int)t.Hours, t.Minutes, t.Seconds) : string.Format("{0}d {1}h {2:D2}m", (int)t.TotalDays, (int)t.Hours, t.Minutes); } return answer; } public static string PrintTimeSpanFromMilliSeconds(double milliSeconds) { TimeSpan t = TimeSpan.FromMilliseconds(milliSeconds); string answer; if (t.TotalMinutes < 1.0) { answer = string.Format("{0}.{1}s", t.Seconds, (decimal)(t.Milliseconds / 100)); } else if (t.TotalHours < 1.0) { answer = string.Format("{0}m {1:D2}s", t.TotalMinutes, t.Seconds); } else if (t.TotalDays < 1.0) { answer = string.Format("{0}h {1:D2}m {2:D2}s", (int)t.TotalHours, t.Minutes, t.Seconds); } else { answer = string.Format("{0}d {1}h {2:D2}m {3:D2}s", (int)t.Days, (int)t.Hours, t.Minutes, t.Seconds); } return answer; } public static MirDirection PreviousDir(MirDirection d) { switch (d) { case MirDirection.Up: return MirDirection.UpLeft; case MirDirection.UpRight: return MirDirection.Up; case MirDirection.Right: return MirDirection.UpRight; case MirDirection.DownRight: return MirDirection.Right; case MirDirection.Down: return MirDirection.DownRight; case MirDirection.DownLeft: return MirDirection.Down; case MirDirection.Left: return MirDirection.DownLeft; case MirDirection.UpLeft: return MirDirection.Left; default: return d; } } public static MirDirection NextDir(MirDirection d) { switch (d) { case MirDirection.Up: return MirDirection.UpRight; case MirDirection.UpRight: return MirDirection.Right; case MirDirection.Right: return MirDirection.DownRight; case MirDirection.DownRight: return MirDirection.Down; case MirDirection.Down: return MirDirection.DownLeft; case MirDirection.DownLeft: return MirDirection.Left; case MirDirection.Left: return MirDirection.UpLeft; case MirDirection.UpLeft: return MirDirection.Up; default: return d; } } public static MirDirection DirectionFromPoint(Point source, Point dest) { if (source.X < dest.X) { if (source.Y < dest.Y) return MirDirection.DownRight; if (source.Y > dest.Y) return MirDirection.UpRight; return MirDirection.Right; } if (source.X > dest.X) { if (source.Y < dest.Y) return MirDirection.DownLeft; if (source.Y > dest.Y) return MirDirection.UpLeft; return MirDirection.Left; } return source.Y < dest.Y ? MirDirection.Down : MirDirection.Up; } public static Size Add(this Size p1, Size p2) { return new Size(p1.Width + p2.Width, p1.Height + p2.Height); } public static Size Add(this Size p1, int width, int height) { return new Size(p1.Width + width, p1.Height + height); } public static Point PointMove(Point p, MirDirection d, int i) { switch (d) { case MirDirection.Up: p.Offset(0, -i); break; case MirDirection.UpRight: p.Offset(i, -i); break; case MirDirection.Right: p.Offset(i, 0); break; case MirDirection.DownRight: p.Offset(i, i); break; case MirDirection.Down: p.Offset(0, i); break; case MirDirection.DownLeft: p.Offset(-i, i); break; case MirDirection.Left: p.Offset(-i, 0); break; case MirDirection.UpLeft: p.Offset(-i, -i); break; } return p; } public static Point Left(Point p, MirDirection d) { switch (d) { case MirDirection.Up: p.Offset(-1, 0); break; case MirDirection.UpRight: p.Offset(-1, -1); break; case MirDirection.Right: p.Offset(0, -1); break; case MirDirection.DownRight: p.Offset(1, -1); break; case MirDirection.Down: p.Offset(1, 0); break; case MirDirection.DownLeft: p.Offset(1, 1); break; case MirDirection.Left: p.Offset(0, 1); break; case MirDirection.UpLeft: p.Offset(-1, 1); break; } return p; } public static Point Right(Point p, MirDirection d) { switch (d) { case MirDirection.Up: p.Offset(1, 0); break; case MirDirection.UpRight: p.Offset(1, 1); break; case MirDirection.Right: p.Offset(0, 1); break; case MirDirection.DownRight: p.Offset(-1, 1); break; case MirDirection.Down: p.Offset(-1, 0); break; case MirDirection.DownLeft: p.Offset(-1, -1); break; case MirDirection.Left: p.Offset(0, -1); break; case MirDirection.UpLeft: p.Offset(1, -1); break; } return p; } public static MirDirection leftDirection(MirDirection d) { switch (d) { case MirDirection.Up: d = MirDirection.UpLeft; break; case MirDirection.UpRight: d = MirDirection.Up; break; case MirDirection.Right: d = MirDirection.UpRight; break; case MirDirection.DownRight: d = MirDirection.Right; break; case MirDirection.Down: d = MirDirection.DownRight; break; case MirDirection.DownLeft: d = MirDirection.Down; break; case MirDirection.Left: d = MirDirection.DownLeft; break; case MirDirection.UpLeft: d = MirDirection.Left; break; } return d; } public static string ToArrow1(this MirDirection dir) { switch (dir) { case MirDirection.Up: return "↑"; case MirDirection.UpRight: return "↗"; case MirDirection.Right: return "→"; case MirDirection.DownRight: return "↘"; case MirDirection.Down: return "↓"; case MirDirection.DownLeft: return "↙"; case MirDirection.Left: return "←"; case MirDirection.UpLeft: return "↖"; default: return "㊥"; } } public static string ToArrow(this MirDirection dir) { switch (dir) { case MirDirection.Up: return "正上↑"; case MirDirection.UpRight: return "左上↗"; case MirDirection.Right: return "正右→"; case MirDirection.DownRight: return "左下↘"; case MirDirection.Down: return "正下↓"; case MirDirection.DownLeft: return "左下↙"; case MirDirection.Left: return "正左←"; case MirDirection.UpLeft: return "左上↖"; default: return "正中㊥"; } } public static MirDirection GetGlobalDirection(Point source, Point target) { var offset=source.Subtract(target); if (target.X>0) { if (target.Y>0) { return MirDirection.UpLeft; } else if (target.Y<0) { return MirDirection.DownLeft; } else { return MirDirection.Left; } } else if (target.X < 0) { if (target.Y > 0) { return MirDirection.UpRight; } else if (target.Y < 0) { return MirDirection.DownRight; } else { return MirDirection.Right; } } else { if (target.Y > 0) { return MirDirection.Up; } else { return MirDirection.Down; } } } public static MirDirection rightDirection(MirDirection d) //找到方向的朝右边上方方向 { switch (d) { case MirDirection.Up: d = MirDirection.UpRight; break; case MirDirection.UpRight: d = MirDirection.Right; break; case MirDirection.Right: d = MirDirection.DownRight; break; case MirDirection.DownRight: d = MirDirection.Down; break; case MirDirection.Down: d = MirDirection.DownLeft; break; case MirDirection.DownLeft: d = MirDirection.Left; break; case MirDirection.Left: d = MirDirection.UpLeft; break; case MirDirection.UpLeft: d = MirDirection.Up; break; } return d; } public static MirDirection rightRowDirection(MirDirection d) { switch (d) { case MirDirection.Up: d = MirDirection.Right; break; case MirDirection.UpRight: d = MirDirection.DownRight; break; case MirDirection.Right: d = MirDirection.Down; break; case MirDirection.DownRight: d = MirDirection.DownLeft; break; case MirDirection.Down: d = MirDirection.Left; break; case MirDirection.DownLeft: d = MirDirection.UpLeft; break; case MirDirection.Left: d = MirDirection.Up; break; case MirDirection.UpLeft: d = MirDirection.UpRight; break; } return d; } public static MirDirection leftRowDirection(MirDirection d) { switch (d) { case MirDirection.Up: d = MirDirection.Left; break; case MirDirection.UpRight: d = MirDirection.UpLeft; break; case MirDirection.Right: d = MirDirection.Up; break; case MirDirection.DownRight: d = MirDirection.UpRight; break; case MirDirection.Down: d = MirDirection.Right; break; case MirDirection.DownLeft: d = MirDirection.DownRight; break; case MirDirection.Left: d = MirDirection.Down; break; case MirDirection.UpLeft: d = MirDirection.DownLeft; break; } return d; } public static int MaxDistance(Point p1, Point p2) { return Math.Max(Math.Abs(p1.X - p2.X), Math.Abs(p1.Y - p2.Y)); } public static MirDirection ReverseDirection(MirDirection dir) { switch (dir) { case MirDirection.Up: return MirDirection.Down; case MirDirection.UpRight: return MirDirection.DownLeft; case MirDirection.Right: return MirDirection.Left; case MirDirection.DownRight: return MirDirection.UpLeft; case MirDirection.Down: return MirDirection.Up; case MirDirection.DownLeft: return MirDirection.UpRight; case MirDirection.Left: return MirDirection.Right; case MirDirection.UpLeft: return MirDirection.DownRight; default: return dir; } } public static ItemInfo GetRealItem(ItemInfo Origin, ushort Level, MirClass job, List ItemList) { if (Origin.ClassBased && Origin.LevelBased) return GetClassAndLevelBasedItem(Origin, job, Level, ItemList); if (Origin.ClassBased) return GetClassBasedItem(Origin, job, ItemList); if (Origin.LevelBased) return GetLevelBasedItem(Origin, Level, ItemList); return Origin; } public static ItemInfo GetLevelBasedItem(ItemInfo Origin, ushort level, List ItemList) { ItemInfo output = Origin; for (int i = 0; i < ItemList.Count; i++) { ItemInfo info = ItemList[i]; if (info.Name.StartsWith(Origin.Name)) if ((info.RequiredType == RequiredType.Level) && (info.RequiredAmount <= level) && (output.RequiredAmount < info.RequiredAmount) && (Origin.RequiredGender == info.RequiredGender)) output = info; } return output; } public static ItemInfo GetClassBasedItem(ItemInfo Origin, MirClass job, List ItemList) { for (int i = 0; i < ItemList.Count; i++) { ItemInfo info = ItemList[i]; if (info.Name.StartsWith(Origin.Name)) if (((byte)info.RequiredClass == (1 << (byte)job)) && (Origin.RequiredGender == info.RequiredGender)) return info; } return Origin; } public static ItemInfo GetClassAndLevelBasedItem(ItemInfo Origin, MirClass job, ushort level, List ItemList) { ItemInfo output = Origin; for (int i = 0; i < ItemList.Count; i++) { ItemInfo info = ItemList[i]; if (info.Name.StartsWith(Origin.Name)) if ((byte)info.RequiredClass == (1 << (byte)job)) if ((info.RequiredType == RequiredType.Level) && (info.RequiredAmount <= level) && (output.RequiredAmount <= info.RequiredAmount) && (Origin.RequiredGender == info.RequiredGender)) output = info; } return output; } public static string StringOverLines(string line, int maxWordsPerLine, int maxLettersPerLine) { string newString = string.Empty; string[] words = line.Split(' '); int lineLength = 0; for (int i = 0; i < words.Length; i++) { lineLength += words[i].Length + 1; newString += words[i] + " "; if (i > 0 && i % maxWordsPerLine == 0 && lineLength > maxLettersPerLine) { lineLength = 0; newString += "\r\n"; } } return newString; } //public static byte[] ImageToByteArray(Image imageIn) //{ // MemoryStream ms = new MemoryStream(); // imageIn.Save(ms, ImageFormat.Gif); // return ms.ToArray(); //} //public static Image ByteArrayToImage(byte[] byteArrayIn) //{ // MemoryStream ms = new MemoryStream(byteArrayIn); // Image returnImage = Image.FromStream(ms); // return returnImage; //} public static IEnumerable SplitArray(byte[] value, int bufferLength) { int countOfArray = value.Length / bufferLength; if (value.Length % bufferLength > 0) countOfArray++; for (int i = 0; i < countOfArray; i++) { yield return value.Skip(i * bufferLength).Take(bufferLength).ToArray(); } } public static byte[] CombineArray(List arrays) { byte[] rv = new byte[arrays.Sum(x => x.Length)]; int offset = 0; foreach (byte[] array in arrays) { System.Buffer.BlockCopy(array, 0, rv, offset, array.Length); offset += array.Length; } return rv; } public static short MaxMineimac(short num) { if (num >= 5) return 5; else if (num <= -5) return -5; else return num; } public static List FindSpellPro(int index) { List templist = new List(); for (int i = 0; i < Globals.Magicelevelps.Count; i++) { if (Globals.Magicelevelps[i].Itemindex == index) templist.Add(Globals.Magicelevelps[i]); } return templist; } public static ExtraDamageItem FindDamageItem(int index) { foreach (ExtraDamageItem item in Globals.DamageItems) { if (item.ItemIndex == index) return item; } return null; } public static SpecialEffectItem FindEffectItem(int index) { foreach (SpecialEffectItem item in Globals.SpecialEffects) { if (item.ItemIndex == index) return item; } return null; } } // 附加属性 -- 直接给角色属性做加成 public class ExtraDamageItem { public int ItemIndex; public double Rate; public byte Type; } // 特殊效果 -- 在特定条件下触发 public class SpecialEffectItem { public int ItemIndex; public double Rate; public byte Type; } public class IgnoreItem { public int Itemindex; public byte IgnoreACnum; public byte IgnoreMACnum; } public class MagicLevelPro { public Spell Spell; public int Itemindex; public byte LevelPro; } public class SelectInfo { public int Index; public string Name = string.Empty; public ushort Level; public MirClass Class; public MirGender Gender; public DateTime LastAccess; public string LocationDown; public SelectInfo() { } public SelectInfo(BinaryReader reader) { Index = reader.ReadInt32(); Name = reader.ReadString(); Level = reader.ReadUInt16(); Class = (MirClass)reader.ReadByte(); Gender = (MirGender)reader.ReadByte(); LastAccess = DateTime.FromBinary(reader.ReadInt64()); LocationDown = reader.ReadString(); } public void Save(BinaryWriter writer) { writer.Write(Index); writer.Write(Name); writer.Write(Level); writer.Write((byte)Class); writer.Write((byte)Gender); writer.Write(LastAccess.ToBinary()); writer.Write(LocationDown); } } public class ItemInfo { public int Index; public string Name = string.Empty; public ItemType Type; public ItemGrade Grade; public RequiredType RequiredType = RequiredType.Level; public RequiredClass RequiredClass = RequiredClass.None; public RequiredGender RequiredGender = RequiredGender.None; public int Set; public short Shape; public byte Weight, Light, RequiredAmount; public ushort Image, Durability; public uint Price, StackSize = 1; public byte MinAC, MaxAC, MinMAC, MaxMAC, MinDC, MaxDC, MinMC, MaxMC, MinSC, MaxSC, Accuracy, Agility; public short FireAC, WindAC, IceAC, LightAC, HolyAC, DarkAC, PhantomAC; public short FireMAC, WindMAC, IceMAC, LightMAC, HolyMAC, DarkMAC, PhantomMAC; public ushort HP, MP; public sbyte AttackSpeed, Luck; public short BagWeight, HandWeight, WearWeight; public bool StartItem; public byte Effect; public byte Strong; public byte MagicResist, PoisonResist, HealthRecovery, SpellRecovery, PoisonRecovery, HPrate, MPrate; public byte CriticalRate, CriticalDamage; public bool NeedIdentify, ShowGroupPickup; public bool ClassBased; public bool LevelBased; public bool CanMine; public bool CanFastRun; public bool CanAwakening; public byte MaxAcRate, MaxMacRate, Holy, Freezing, PoisonAttack, HpDrainRate; public BindMode Bind = BindMode.none; public byte Reflect,Parry,IgnoreAC,IgnoreMAC; public SpecialItemMode Unique = SpecialItemMode.None; public byte RandomStatsId; public RandomItemStat RandomStats; public string ToolTip = string.Empty; public byte HideMinAC, HideMaxAC, HideMinMAC, HideMaxMAC, HideMinDC, HideMaxDC, HideMinMC, HideMaxMC, HideMinSC, HideMaxSC, HideAccuracy, HideAgility; public byte HideMagicResist, HidePoisonResist, HideHealthRecovery, HideSpellRecovery, HidePoisonRecovery; public byte HideMaxAcRate, HideMaxMacRate, HideHoly, HideFreezing, HidePoisonAttack, HideHpDrainRate; public byte HideCriticalRate, HideCriticalDamage; public short HideFireAC, HideWindAC, HideIceAC, HideLightAC, HideHolyAC, HideDarkAC, HidePhantomAC; public short HideFireMAC, HideWindMAC, HideIceMAC, HideLightMAC, HideHolyMAC, HideDarkMAC, HidePhantomMAC; public sbyte HideAttackSpeed, HideLuck; public byte HideStrong, HideReflect,HideParry, HideIgnoreAC, HideIgnoreMAC; public byte Bt; public bool IsConsumable { get { return Type == ItemType.Potion || Type == ItemType.Scroll || Type == ItemType.Food || Type == ItemType.Transform; } } public string FriendlyName { get { string temp = Name; temp = Regex.Replace(temp, @"\d+$", string.Empty); //hides end numbers temp = Regex.Replace(temp, @"\[[^]]*\]", string.Empty); //hides square brackets return temp; } } public ItemInfo() { } public ItemInfo(MySqlDataReader readerItemInfo) { Index = Convert.ToInt32(readerItemInfo["IndexID"]); Name = readerItemInfo["Name"].ToString(); Type = (ItemType)Convert.ToByte(readerItemInfo["Type"]); Grade = (ItemGrade)Convert.ToUInt16(readerItemInfo["Grade"]); RequiredType = (RequiredType)Convert.ToByte(readerItemInfo["RequiredType"]); RequiredClass = (RequiredClass)Convert.ToByte(readerItemInfo["RequiredClass"]); RequiredGender = (RequiredGender)Convert.ToByte(readerItemInfo["RequiredGender"]); Set = (int)Convert.ToByte(readerItemInfo["Set_"]); Shape = Convert.ToInt16(readerItemInfo["Shape"]); Weight = Convert.ToByte(readerItemInfo["Weight"]); Light = Convert.ToByte(readerItemInfo["Light"]); RequiredAmount = Convert.ToByte(readerItemInfo["RequiredAmount"]); Image = Convert.ToUInt16(readerItemInfo["Image"]); Durability = Convert.ToUInt16(readerItemInfo["Durability"]); StackSize = Convert.ToUInt32(readerItemInfo["StackSize"]); Price = Convert.ToUInt32(readerItemInfo["Price"]); MinAC = Convert.ToByte(readerItemInfo["MinAC"]); MaxAC = Convert.ToByte(readerItemInfo["MaxAC"]); MinMAC = Convert.ToByte(readerItemInfo["MinMAC"]); MaxMAC = Convert.ToByte(readerItemInfo["MaxMAC"]); MinDC = Convert.ToByte(readerItemInfo["MinDC"]); MaxDC = Convert.ToByte(readerItemInfo["MaxDC"]); MinMC = Convert.ToByte(readerItemInfo["MinMC"]); MaxMC = Convert.ToByte(readerItemInfo["MaxMC"]); MinSC = Convert.ToByte(readerItemInfo["MinSC"]); MaxSC = Convert.ToByte(readerItemInfo["MaxSC"]); HP = Convert.ToUInt16(readerItemInfo["HP"]); MP = Convert.ToUInt16(readerItemInfo["MP"]); Accuracy = Convert.ToByte(readerItemInfo["Accuracy"]); Agility = Convert.ToByte(readerItemInfo["Agility"]); FireAC = Convert.ToInt16(readerItemInfo["FireAC"]); WindAC = Convert.ToInt16(readerItemInfo["WindAC"]); IceAC = Convert.ToInt16(readerItemInfo["IceAC"]); LightAC = Convert.ToInt16(readerItemInfo["LightAC"]); HolyAC = Convert.ToInt16(readerItemInfo["HolyAC"]); DarkAC = Convert.ToInt16(readerItemInfo["DarkAC"]); PhantomAC = Convert.ToInt16(readerItemInfo["PhantomAC"]); FireMAC = Convert.ToInt16(readerItemInfo["FireMAC"]); WindMAC = Convert.ToInt16(readerItemInfo["WindMAC"]); IceMAC = Convert.ToInt16(readerItemInfo["IceMAC"]); LightMAC = Convert.ToInt16(readerItemInfo["LightMAC"]); HolyMAC = Convert.ToInt16(readerItemInfo["HolyMAC"]); DarkMAC = Convert.ToInt16(readerItemInfo["DarkMAC"]); PhantomMAC = Convert.ToInt16(readerItemInfo["PhantomMAC"]); Luck = Convert.ToSByte(readerItemInfo["Luck"]); AttackSpeed = Convert.ToSByte(readerItemInfo["AttackSpeed"]); StartItem = Convert.ToBoolean(readerItemInfo["StartItem"]); BagWeight = Convert.ToInt16(readerItemInfo["BagWeight"]); HandWeight = Convert.ToInt16(readerItemInfo["HandWeight"]); WearWeight = Convert.ToInt16(readerItemInfo["WearWeight"]); Effect = Convert.ToByte(readerItemInfo["Effect"]); Strong = Convert.ToByte(readerItemInfo["Strong"]); MagicResist = Convert.ToByte(readerItemInfo["MagicResist"]); PoisonResist = Convert.ToByte(readerItemInfo["PoisonResist"]); HealthRecovery = Convert.ToByte(readerItemInfo["HealthRecovery"]); SpellRecovery = Convert.ToByte(readerItemInfo["SpellRecovery"]); PoisonRecovery = Convert.ToByte(readerItemInfo["PoisonRecovery"]); HPrate = Convert.ToByte(readerItemInfo["HPrate"]); MPrate = Convert.ToByte(readerItemInfo["MPrate"]); CriticalRate = Convert.ToByte(readerItemInfo["CriticalRate"]); CriticalDamage = Convert.ToByte(readerItemInfo["CriticalDamage"]); NeedIdentify = Convert.ToBoolean(readerItemInfo["NeedIdentify"]); ShowGroupPickup = Convert.ToBoolean(readerItemInfo["ShowGroupPickup"]); ClassBased = Convert.ToBoolean(readerItemInfo["ClassBased"]); LevelBased = Convert.ToBoolean(readerItemInfo["LevelBased"]); CanMine = Convert.ToBoolean(readerItemInfo["CanMine"]); MaxAcRate = Convert.ToByte(readerItemInfo["MaxAcRate"]); MaxMacRate = Convert.ToByte(readerItemInfo["MaxMacRate"]); Holy = Convert.ToByte(readerItemInfo["Holy"]); Freezing = Convert.ToByte(readerItemInfo["Freezing"]); PoisonAttack = Convert.ToByte(readerItemInfo["PoisonAttack"]); Bind = (BindMode)Convert.ToUInt16(readerItemInfo["Bind"]); Reflect = Convert.ToByte(readerItemInfo["Reflect"]); Parry = Convert.ToByte(readerItemInfo["Parry"]); HideParry = Convert.ToByte(readerItemInfo["HideParry"]); IgnoreAC = Convert.ToByte(readerItemInfo["IgnoreAC"]); HideIgnoreAC = Convert.ToByte(readerItemInfo["HideIgnoreAC"]); IgnoreMAC = Convert.ToByte(readerItemInfo["IgnoreMAC"]); HideIgnoreMAC = Convert.ToByte(readerItemInfo["HideIgnoreMAC"]); HpDrainRate = Convert.ToByte(readerItemInfo["HpDrainRate"]); Unique = (SpecialItemMode)Convert.ToUInt16(readerItemInfo["Unique_"]); RandomStatsId = Convert.ToByte(readerItemInfo["RandomStatsId"]); CanFastRun = Convert.ToBoolean(readerItemInfo["CanFastRun"]); CanAwakening = Convert.ToBoolean(readerItemInfo["CanAwakening"]); // RandomStats = (RandomItemStat)readerItemInfo["RandomStats"]; ToolTip = readerItemInfo["ToolTip"].ToString(); //if ((readerItemInfo != null) && (RandomStatsId < Server.Settings.RandomItemStatsList.Count)) //{ // RandomStats = Server.Settings.RandomItemStatsList[RandomStatsId]; //} HideMinAC = Convert.ToByte(readerItemInfo["HideMinAC"]); HideMaxAC = Convert.ToByte(readerItemInfo["HideMaxAC"]); HideMinMAC = Convert.ToByte(readerItemInfo["HideMinMAC"]); HideMaxMAC = Convert.ToByte(readerItemInfo["HideMaxMAC"]); HideMinDC = Convert.ToByte(readerItemInfo["HideMinDC"]); HideMaxDC = Convert.ToByte(readerItemInfo["HideMaxDC"]); HideMinMC = Convert.ToByte(readerItemInfo["HideMinMC"]); HideMaxMC = Convert.ToByte(readerItemInfo["HideMaxMC"]); HideMinSC = Convert.ToByte(readerItemInfo["HideMinSC"]); HideMaxSC = Convert.ToByte(readerItemInfo["HideMaxSC"]); HideAccuracy = Convert.ToByte(readerItemInfo["HideAccuracy"]); HideAgility = Convert.ToByte(readerItemInfo["HideAgility"]); HideFireAC = Convert.ToInt16(readerItemInfo["HideFireAC"]); HideWindAC = Convert.ToInt16(readerItemInfo["HideWindAC"]); HideIceAC = Convert.ToInt16(readerItemInfo["HideIceAC"]); HideLightAC = Convert.ToInt16(readerItemInfo["HideLightAC"]); HideHolyAC = Convert.ToInt16(readerItemInfo["HideHolyAC"]); HideDarkAC = Convert.ToInt16(readerItemInfo["HideDarkAC"]); HidePhantomAC = Convert.ToInt16(readerItemInfo["HidePhantomAC"]); HideFireMAC = Convert.ToInt16(readerItemInfo["HideFireMAC"]); HideWindMAC = Convert.ToInt16(readerItemInfo["HideWindMAC"]); HideIceMAC = Convert.ToInt16(readerItemInfo["HideIceMAC"]); HideLightMAC = Convert.ToInt16(readerItemInfo["HideLightMAC"]); HideHolyMAC = Convert.ToInt16(readerItemInfo["HideHolyMAC"]); HideDarkMAC = Convert.ToInt16(readerItemInfo["HideDarkMAC"]); HidePhantomMAC = Convert.ToInt16(readerItemInfo["HidePhantomMAC"]); HideMagicResist = Convert.ToByte(readerItemInfo["HideMagicResist"]); HidePoisonResist = Convert.ToByte(readerItemInfo["HidePoisonResist"]); HideHealthRecovery = Convert.ToByte(readerItemInfo["HideHealthRecovery"]); HideSpellRecovery = Convert.ToByte(readerItemInfo["HideSpellRecovery"]); HidePoisonRecovery = Convert.ToByte(readerItemInfo["HidePoisonRecovery"]); HideMaxAcRate = Convert.ToByte(readerItemInfo["HideMaxAcRate"]); HideHpDrainRate = Convert.ToByte(readerItemInfo["HideHpDrainRate"]); HideMaxMacRate = Convert.ToByte(readerItemInfo["HideMaxMacRate"]); HideHoly = Convert.ToByte(readerItemInfo["HideHoly"]); HideFreezing = Convert.ToByte(readerItemInfo["HideFreezing"]); HidePoisonAttack = Convert.ToByte(readerItemInfo["HidePoisonAttack"]); HideCriticalRate = Convert.ToByte(readerItemInfo["HideCriticalRate"]); HideCriticalDamage = Convert.ToByte(readerItemInfo["HideCriticalDamage"]); HideLuck = Convert.ToSByte(readerItemInfo["HideLuck"]); HideAttackSpeed = Convert.ToSByte(readerItemInfo["HideAttackSpeed"]); HideStrong = Convert.ToByte(readerItemInfo["HideStrong"]); HideReflect = Convert.ToByte(readerItemInfo["HideReflect"]); Bt = Convert.ToByte(readerItemInfo["Bt"]); } public ItemInfo(BinaryReader reader, int version = int.MaxValue, int Customversion = int.MaxValue) { Index = reader.ReadInt32(); Name = reader.ReadString(); //1 Type = (ItemType)reader.ReadByte(); //2 if (version >= 40) Grade = (ItemGrade)reader.ReadByte(); //3 RequiredType = (RequiredType)reader.ReadByte(); RequiredClass = (RequiredClass)reader.ReadByte(); RequiredGender = (RequiredGender)reader.ReadByte(); if (version >= 17) Set = (int)reader.ReadByte(); Shape = version >= 30 ? reader.ReadInt16() : reader.ReadSByte(); Weight = reader.ReadByte(); Light = reader.ReadByte(); RequiredAmount = reader.ReadByte(); Image = reader.ReadUInt16(); Durability = reader.ReadUInt16(); StackSize = reader.ReadUInt32(); Price = reader.ReadUInt32(); MinAC = reader.ReadByte(); MaxAC = reader.ReadByte(); MinMAC = reader.ReadByte(); MaxMAC = reader.ReadByte(); MinDC = reader.ReadByte(); MaxDC = reader.ReadByte(); MinMC = reader.ReadByte(); MaxMC = reader.ReadByte(); MinSC = reader.ReadByte(); MaxSC = reader.ReadByte(); if (version < 25) { HP = reader.ReadByte(); MP = reader.ReadByte(); } else { HP = reader.ReadUInt16(); MP = reader.ReadUInt16(); } Accuracy = reader.ReadByte(); Agility = reader.ReadByte(); FireAC = reader.ReadInt16(); WindAC = reader.ReadInt16(); IceAC = reader.ReadInt16(); LightAC = reader.ReadInt16(); HolyAC = reader.ReadInt16(); DarkAC = reader.ReadInt16(); PhantomAC = reader.ReadInt16(); FireMAC = reader.ReadInt16(); WindMAC = reader.ReadInt16(); IceMAC = reader.ReadInt16(); LightMAC = reader.ReadInt16(); HolyMAC = reader.ReadInt16(); DarkMAC = reader.ReadInt16(); PhantomMAC = reader.ReadInt16(); Luck = reader.ReadSByte(); AttackSpeed = reader.ReadSByte(); StartItem = reader.ReadBoolean(); BagWeight = reader.ReadInt16(); HandWeight = reader.ReadInt16(); WearWeight = reader.ReadInt16(); if (version >= 9) Effect = reader.ReadByte(); if (version >= 20) { Strong = reader.ReadByte(); MagicResist = reader.ReadByte(); PoisonResist = reader.ReadByte(); HealthRecovery = reader.ReadByte(); SpellRecovery = reader.ReadByte(); PoisonRecovery = reader.ReadByte(); HPrate = reader.ReadByte(); MPrate = reader.ReadByte(); CriticalRate = reader.ReadByte(); CriticalDamage = reader.ReadByte(); byte bools = reader.ReadByte(); NeedIdentify = (bools & 0x01) == 0x01; ShowGroupPickup = (bools & 0x02) == 0x02; ClassBased = (bools & 0x04) == 0x04; LevelBased = (bools & 0x08) == 0x08; CanMine = (bools & 0x10) == 0x10; MaxAcRate = reader.ReadByte(); MaxMacRate = reader.ReadByte(); Holy = reader.ReadByte(); Freezing = reader.ReadByte(); PoisonAttack = reader.ReadByte(); if (version < 55) { Bind = (BindMode)reader.ReadByte(); } else { Bind = (BindMode)reader.ReadInt16(); } } if (version >= 21) { Reflect = reader.ReadByte(); HpDrainRate = reader.ReadByte(); Unique = (SpecialItemMode)reader.ReadInt16(); } if (version >= 24) { RandomStatsId = reader.ReadByte(); } else { RandomStatsId = 255; if ((Type == ItemType.Weapon) || (Type == ItemType.Armour) || (Type == ItemType.Helmet) || (Type == ItemType.Necklace) || (Type == ItemType.Bracelet) || (Type == ItemType.Ring) || (Type == ItemType.Mount)) RandomStatsId = (byte)Type; if ((Type == ItemType.Belt) || (Type == ItemType.Boots)) RandomStatsId = 7; } if (version >= 40) CanFastRun = reader.ReadBoolean(); if (version >= 41) { CanAwakening = reader.ReadBoolean(); bool isTooltip = reader.ReadBoolean(); if (isTooltip) ToolTip = reader.ReadString(); } if (version < 70) //before db version 70 all specialitems had wedding rings disabled, after that it became a server option { if ((Type == ItemType.Ring) && (Unique != SpecialItemMode.None)) Bind |= BindMode.NoWeddingRing; } Parry=reader.ReadByte(); IgnoreAC=reader.ReadByte(); IgnoreMAC=reader.ReadByte(); } public void Save(BinaryWriter writer) { writer.Write(Index); writer.Write(Name); writer.Write((byte)Type); writer.Write((byte)Grade); writer.Write((byte)RequiredType); writer.Write((byte)RequiredClass); writer.Write((byte)RequiredGender); writer.Write((byte)Set); writer.Write(Shape); writer.Write(Weight); writer.Write(Light); writer.Write(RequiredAmount); writer.Write(Image); writer.Write(Durability); writer.Write(StackSize); writer.Write(Price); writer.Write(MinAC); writer.Write(MaxAC); writer.Write(MinMAC); writer.Write(MaxMAC); writer.Write(MinDC); writer.Write(MaxDC); writer.Write(MinMC); writer.Write(MaxMC); writer.Write(MinSC); writer.Write(MaxSC); writer.Write(HP); writer.Write(MP); writer.Write(Accuracy); writer.Write(Agility); writer.Write(FireAC); writer.Write(WindAC); writer.Write(IceAC); writer.Write(LightAC); writer.Write(HolyAC); writer.Write(DarkAC); writer.Write(PhantomAC); writer.Write(FireMAC); writer.Write(WindMAC); writer.Write(IceMAC); writer.Write(LightMAC); writer.Write(HolyMAC); writer.Write(DarkMAC); writer.Write(PhantomMAC); writer.Write(Luck); writer.Write(AttackSpeed); writer.Write(StartItem); writer.Write(BagWeight); writer.Write(HandWeight); writer.Write(WearWeight); writer.Write(Effect); writer.Write(Strong); writer.Write(MagicResist); writer.Write(PoisonResist); writer.Write(HealthRecovery); writer.Write(SpellRecovery); writer.Write(PoisonRecovery); writer.Write(HPrate); writer.Write(MPrate); writer.Write(CriticalRate); writer.Write(CriticalDamage); byte bools = 0; if (NeedIdentify) bools |= 0x01; if (ShowGroupPickup) bools |= 0x02; if (ClassBased) bools |= 0x04; if (LevelBased) bools |= 0x08; if (CanMine) bools |= 0x10; writer.Write(bools); writer.Write(MaxAcRate); writer.Write(MaxMacRate); writer.Write(Holy); writer.Write(Freezing); writer.Write(PoisonAttack); writer.Write((short)Bind); writer.Write(Reflect); writer.Write(HpDrainRate); writer.Write((short)Unique); writer.Write(RandomStatsId); writer.Write(CanFastRun); writer.Write(CanAwakening); writer.Write(ToolTip != null); if (ToolTip != null) writer.Write(ToolTip); writer.Write(Parry); writer.Write(IgnoreAC); writer.Write(IgnoreMAC); } public static ItemInfo FromText(string text) { string[] data = text.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries); if (data.Length < 33) return null; ItemInfo info = new ItemInfo { Name = data[0] }; if (!Enum.TryParse(data[1], out info.Type)) return null; if (!Enum.TryParse(data[2], out info.Grade)) return null; if (!Enum.TryParse(data[3], out info.RequiredType)) return null; if (!Enum.TryParse(data[4], out info.RequiredClass)) return null; if (!Enum.TryParse(data[5], out info.RequiredGender)) return null; if (!int.TryParse(data[6], out info.Set)) return null; if (!short.TryParse(data[7], out info.Shape)) return null; if (!byte.TryParse(data[8], out info.Weight)) return null; if (!byte.TryParse(data[9], out info.Light)) return null; if (!byte.TryParse(data[10], out info.RequiredAmount)) return null; if (!byte.TryParse(data[11], out info.MinAC)) return null; if (!byte.TryParse(data[12], out info.MaxAC)) return null; if (!byte.TryParse(data[13], out info.MinMAC)) return null; if (!byte.TryParse(data[14], out info.MaxMAC)) return null; if (!byte.TryParse(data[15], out info.MinDC)) return null; if (!byte.TryParse(data[16], out info.MaxDC)) return null; if (!byte.TryParse(data[17], out info.MinMC)) return null; if (!byte.TryParse(data[18], out info.MaxMC)) return null; if (!byte.TryParse(data[19], out info.MinSC)) return null; if (!byte.TryParse(data[20], out info.MaxSC)) return null; if (!byte.TryParse(data[21], out info.Accuracy)) return null; if (!byte.TryParse(data[22], out info.Agility)) return null; if (!short.TryParse(data[23], out info.FireAC)) return null; if (!short.TryParse(data[24], out info.WindAC)) return null; if (!short.TryParse(data[25], out info.IceAC)) return null; if (!short.TryParse(data[26], out info.LightAC)) return null; if (!short.TryParse(data[27], out info.HolyAC)) return null; if (!short.TryParse(data[28], out info.DarkAC)) return null; if (!short.TryParse(data[29], out info.PhantomAC)) return null; if (!short.TryParse(data[30], out info.FireMAC)) return null; if (!short.TryParse(data[31], out info.WindMAC)) return null; if (!short.TryParse(data[32], out info.IceMAC)) return null; if (!short.TryParse(data[33], out info.LightMAC)) return null; if (!short.TryParse(data[34], out info.HolyMAC)) return null; if (!short.TryParse(data[35], out info.DarkMAC)) return null; if (!short.TryParse(data[36], out info.PhantomMAC)) return null; if (!ushort.TryParse(data[37], out info.HP)) return null; if (!ushort.TryParse(data[38], out info.MP)) return null; if (!sbyte.TryParse(data[39], out info.AttackSpeed)) return null; if (!sbyte.TryParse(data[40], out info.Luck)) return null; if (!short.TryParse(data[41], out info.BagWeight)) return null; if (!short.TryParse(data[42], out info.HandWeight)) return null; if (!short.TryParse(data[43], out info.WearWeight)) return null; if (!bool.TryParse(data[44], out info.StartItem)) return null; if (!ushort.TryParse(data[45], out info.Image)) return null; if (!ushort.TryParse(data[46], out info.Durability)) return null; if (!uint.TryParse(data[47], out info.Price)) return null; if (!uint.TryParse(data[48], out info.StackSize)) return null; if (!byte.TryParse(data[49], out info.Effect)) return null; if (!byte.TryParse(data[50], out info.Strong)) return null; if (!byte.TryParse(data[51], out info.MagicResist)) return null; if (!byte.TryParse(data[52], out info.PoisonResist)) return null; if (!byte.TryParse(data[53], out info.HealthRecovery)) return null; if (!byte.TryParse(data[54], out info.SpellRecovery)) return null; if (!byte.TryParse(data[55], out info.PoisonRecovery)) return null; if (!byte.TryParse(data[56], out info.HPrate)) return null; if (!byte.TryParse(data[57], out info.MPrate)) return null; if (!byte.TryParse(data[58], out info.CriticalRate)) return null; if (!byte.TryParse(data[59], out info.CriticalDamage)) return null; if (!bool.TryParse(data[60], out info.NeedIdentify)) return null; if (!bool.TryParse(data[61], out info.ShowGroupPickup)) return null; if (!byte.TryParse(data[62], out info.MaxAcRate)) return null; if (!byte.TryParse(data[63], out info.MaxMacRate)) return null; if (!byte.TryParse(data[64], out info.Holy)) return null; if (!byte.TryParse(data[65], out info.Freezing)) return null; if (!byte.TryParse(data[66], out info.PoisonAttack)) return null; if (!bool.TryParse(data[67], out info.ClassBased)) return null; if (!bool.TryParse(data[68], out info.LevelBased)) return null; if (!Enum.TryParse(data[69], out info.Bind)) return null; if (!byte.TryParse(data[70], out info.Reflect)) return null; if (!byte.TryParse(data[71], out info.HpDrainRate)) return null; if (!Enum.TryParse(data[72], out info.Unique)) return null; if (!byte.TryParse(data[73], out info.RandomStatsId)) return null; if (!bool.TryParse(data[74], out info.CanMine)) return null; if (!bool.TryParse(data[75], out info.CanFastRun)) return null; if (!bool.TryParse(data[76], out info.CanAwakening)) return null; if (!byte.TryParse(data[77], out info.Parry)) return null; if (!byte.TryParse(data[78], out info.HideParry)) return null; if (!byte.TryParse(data[79], out info.IgnoreAC)) return null; if (!byte.TryParse(data[80], out info.HideIgnoreAC)) return null; if (!byte.TryParse(data[81], out info.IgnoreMAC)) return null; if (!byte.TryParse(data[82], out info.HideIgnoreMAC)) return null; if (data[83] == "-") info.ToolTip = ""; else { info.ToolTip = data[83]; info.ToolTip = info.ToolTip.Replace("&^&", "\r\n"); } return info; } public string ToText() { string TransToolTip = ToolTip; int length = TransToolTip.Length; if (TransToolTip == null || TransToolTip.Length == 0) { TransToolTip = "-"; } else { TransToolTip = TransToolTip.Replace("\r\n", "&^&"); } return string.Format("{0},{1},{2},{3},{4},{5},{6},{7},{8},{9},{10},{11},{12},{13},{14},{15},{16},{17},{18},{19},{20},{21},{22},{23},{24},{25},{26}," + "{27},{28},{29},{30},{31},{32},{33},{34},{35},{36},{37},{38},{39},{40},{41},{42},{43},{44},{45},{46},{47},{48},{49},{50},{51}," + "{52},{53},{54},{55},{56},{57},{58},{59},{60},{61},{62},{63},{64},{65},{66},{67},{68},{69},{70},{71},{72},{73},{74},{75},{76},{77}", Name, (byte)Type, (byte)Grade, (byte)RequiredType, (byte)RequiredClass, (byte)RequiredGender, (byte)Set, Shape, Weight, Light, RequiredAmount, MinAC, MaxAC, MinMAC, MaxMAC, MinDC, MaxDC, MinMC, MaxMC, MinSC, MaxSC, Accuracy, Agility, FireAC, WindAC, IceAC, LightAC, HolyAC, DarkAC, PhantomAC, FireMAC, WindMAC, IceMAC, LightMAC, HolyMAC, DarkMAC, PhantomMAC, HP, MP, AttackSpeed, Luck, BagWeight, HandWeight, WearWeight, StartItem, Image, Durability, Price, StackSize, Effect, Strong, MagicResist, PoisonResist, HealthRecovery, SpellRecovery, PoisonRecovery, HPrate, MPrate, CriticalRate, CriticalDamage, NeedIdentify, ShowGroupPickup, MaxAcRate, MaxMacRate, Holy, Freezing, PoisonAttack, ClassBased, LevelBased, (short)Bind, Reflect, HpDrainRate, (short)Unique, RandomStatsId, CanMine, CanFastRun, CanAwakening,Parry,HideParry,IgnoreAC,HideIgnoreAC,IgnoreMAC,HideIgnoreMAC, TransToolTip); } public Color GetNameColor() { if (Grade == ItemGrade.None) return Color.DarkGray; if (Grade == ItemGrade.高级) return Color.DeepSkyBlue; if (Grade == ItemGrade.稀有) return Color.DarkOrange; if (Grade == ItemGrade.神器) return Color.Fuchsia; if (Grade == ItemGrade.一般) return Color.Lime; return Color.White; } public override string ToString() { //return string.Format("{0}: {1}", Index, Name); return Name; } } public class UserItem { public ulong UniqueID; public int ItemIndex; public ItemInfo Info; public int CurrentDura, MaxDura; public string Store; public int InitialPosition; public uint Count = 1, GemCount = 0; public byte AC, MAC, DC, MC, SC, Accuracy, Agility, HP, MP, Strong, MagicResist, PoisonResist, HealthRecovery, ManaRecovery, PoisonRecovery, CriticalRate, CriticalDamage, Freezing, PoisonAttack, Reflect, MaxAcRate, MaxMacRate,Parry,IgnoreAC,IgnoreMAC; public byte HideAC, HideMAC, HideDC, HideMC, HideSC, HideAccuracy, HideAgility; public byte BagWeight, WearWeight, HandWeight; public short FireAC, WindAC, IceAC, LightAC, HolyAC, DarkAC, PhantomAC; public short FireMAC, WindMAC, IceMAC, LightMAC, HolyMAC, DarkMAC, PhantomMAC; public int DropProtect; //装备颜色 public byte IR; public byte IG; public byte IB; public uint WpLevelExp; public sbyte AttackSpeed, Luck; public RefinedValue RefinedValue = RefinedValue.None; public byte RefineAdded = 0; public bool DuraChanged; public int SoulBoundId = -1; public bool Identified = false; public bool Cursed = false; public int WeddingRing = -1; public ulong Attached; public bool IsAttached = false; public int AwakeType; public bool IsAwake = false; public UserItem[] Slots = new UserItem[5]; public DateTime ExpiryDate; public DateTime BuybackExpiryDate; public ExpireInfo ExpireInfo; public string MakeName; public short Make; public int SuperRefineLevel; public DateTime DropProtectTick; public Awake Awake = new Awake(); public bool IsAdded { get { return AC != 0 || MAC != 0 || DC != 0 || MC != 0 || SC != 0 || Accuracy != 0 || Agility != 0 || HP != 0 || MP != 0 || AttackSpeed != 0 || Luck != 0 || Strong != 0 || MagicResist != 0 || PoisonResist != 0 || HealthRecovery != 0 || ManaRecovery != 0 || PoisonRecovery != 0 || CriticalRate != 0 || CriticalDamage != 0 || Freezing != 0 || PoisonAttack != 0 || Reflect != 0 || MaxMacRate != 0 || MaxMacRate != 0 || FireAC != 0 || WindAC != 0 || IceAC != 0 || LightAC != 0 || HolyAC != 0 || DarkAC != 0 || PhantomAC != 0 || FireMAC != 0 || WindMAC != 0 || IceMAC != 0 || LightMAC != 0 || HolyMAC != 0 || DarkMAC != 0 || PhantomMAC != 0; } } public uint Weight { get { return Info.Type == ItemType.Amulet ? Info.Weight : Info.Weight * Count; } } public string Name { get { return Count > 1 ? string.Format("{0} ({1})", Info.Name, Count) : Info.Name; } } public string FriendlyName { get { return Count > 1 ? string.Format("{0} ({1})", Info.FriendlyName, Count) : Info.FriendlyName; } } public UserItem() { } public UserItem(ItemInfo info) { SoulBoundId = -1; ItemIndex = info.Index; Info = info; SetSlotSize(); } public UserItem(BinaryReader reader, int version = int.MaxValue, int Customversion = int.MaxValue) { UniqueID = reader.ReadUInt64(); ItemIndex = reader.ReadInt32(); CurrentDura = reader.ReadInt32(); MaxDura = reader.ReadInt32(); Count = reader.ReadUInt32(); AC = reader.ReadByte(); MAC = reader.ReadByte(); DC = reader.ReadByte(); MC = reader.ReadByte(); SC = reader.ReadByte(); Accuracy = reader.ReadByte(); Agility = reader.ReadByte(); BagWeight = reader.ReadByte(); WearWeight = reader.ReadByte(); HandWeight = reader.ReadByte(); FireAC = reader.ReadInt16(); WindAC = reader.ReadInt16(); IceAC = reader.ReadInt16(); LightAC = reader.ReadInt16(); HolyAC = reader.ReadInt16(); DarkAC = reader.ReadInt16(); PhantomAC = reader.ReadInt16(); FireMAC = reader.ReadInt16(); WindMAC = reader.ReadInt16(); IceMAC = reader.ReadInt16(); LightMAC = reader.ReadInt16(); HolyMAC = reader.ReadInt16(); DarkMAC = reader.ReadInt16(); PhantomMAC = reader.ReadInt16(); //装备颜色 IR = reader.ReadByte(); IG = reader.ReadByte(); IB = reader.ReadByte(); WpLevelExp = reader.ReadUInt32(); HP = reader.ReadByte(); MP = reader.ReadByte(); AttackSpeed = reader.ReadSByte(); Luck = reader.ReadSByte(); if (version <= 19) return; SoulBoundId = reader.ReadInt32(); byte Bools = reader.ReadByte(); Identified = (Bools & 0x01) == 0x01; Cursed = (Bools & 0x02) == 0x02; Strong = reader.ReadByte(); MagicResist = reader.ReadByte(); PoisonResist = reader.ReadByte(); HealthRecovery = reader.ReadByte(); ManaRecovery = reader.ReadByte(); PoisonRecovery = reader.ReadByte(); CriticalRate = reader.ReadByte(); CriticalDamage = reader.ReadByte(); Freezing = reader.ReadByte(); PoisonAttack = reader.ReadByte(); if (version <= 31) return; int count = reader.ReadInt32(); for (int i = 0; i < count; i++) { if (reader.ReadBoolean()) continue; UserItem item = new UserItem(reader, version, Customversion); Slots[i] = item; } if (version <= 38) return; GemCount = reader.ReadUInt32(); if (version <= 40) return; Awake = new Awake(reader); if (version <= 56) return; RefinedValue = (RefinedValue)reader.ReadByte(); RefineAdded = reader.ReadByte(); if (version < 60) return; WeddingRing = reader.ReadInt32(); if (version < 65) return; if (reader.ReadBoolean()) { ExpireInfo = new ExpireInfo(reader, version, Customversion); } HideAC = reader.ReadByte(); HideMAC = reader.ReadByte(); HideDC = reader.ReadByte(); HideMC = reader.ReadByte(); HideSC = reader.ReadByte(); HideAccuracy = reader.ReadByte(); HideAgility = reader.ReadByte(); Reflect = reader.ReadByte(); MaxAcRate = reader.ReadByte(); MaxMacRate = reader.ReadByte(); MakeName = reader.ReadString(); Make = reader.ReadInt16(); Parry=reader.ReadByte(); IgnoreAC=reader.ReadByte(); IgnoreMAC=reader.ReadByte(); DropProtect=reader.ReadInt32(); SuperRefineLevel=reader.ReadInt32(); } public void Save(BinaryWriter writer) { writer.Write(UniqueID); writer.Write(ItemIndex); writer.Write(CurrentDura); writer.Write(MaxDura); writer.Write(Count); writer.Write(AC); writer.Write(MAC); writer.Write(DC); writer.Write(MC); writer.Write(SC); writer.Write(Accuracy); writer.Write(Agility); writer.Write(BagWeight); writer.Write(WearWeight); writer.Write(HandWeight); writer.Write(FireAC); writer.Write(WindAC); writer.Write(IceAC); writer.Write(LightAC); writer.Write(HolyAC); writer.Write(DarkAC); writer.Write(PhantomAC); writer.Write(FireMAC); writer.Write(WindMAC); writer.Write(IceMAC); writer.Write(LightMAC); writer.Write(HolyMAC); writer.Write(DarkMAC); writer.Write(PhantomMAC); writer.Write(IR); writer.Write(IG); writer.Write(IB); writer.Write(WpLevelExp); writer.Write(HP); writer.Write(MP); writer.Write(AttackSpeed); writer.Write(Luck); writer.Write(SoulBoundId); byte Bools = 0; if (Identified) Bools |= 0x01; if (Cursed) Bools |= 0x02; writer.Write(Bools); writer.Write(Strong); writer.Write(MagicResist); writer.Write(PoisonResist); writer.Write(HealthRecovery); writer.Write(ManaRecovery); writer.Write(PoisonRecovery); writer.Write(CriticalRate); writer.Write(CriticalDamage); writer.Write(Freezing); writer.Write(PoisonAttack); writer.Write(Slots.Length); for (int i = 0; i < Slots.Length; i++) { writer.Write(Slots[i] == null); if (Slots[i] == null) continue; Slots[i].Save(writer); } writer.Write(GemCount); Awake.Save(writer); writer.Write((byte)RefinedValue); writer.Write(RefineAdded); writer.Write(WeddingRing); writer.Write(ExpireInfo != null); if (ExpireInfo != null) { ExpireInfo.Save(writer); } writer.Write(HideAC); writer.Write(HideMAC); writer.Write(HideDC); writer.Write(HideMC); writer.Write(HideSC); writer.Write(HideAccuracy); writer.Write(HideAgility); writer.Write(Reflect); writer.Write(MaxAcRate); writer.Write(MaxMacRate); if (MakeName == null) { writer.Write("null"); } else { writer.Write(MakeName); } writer.Write((short)Make); writer.Write(Parry); writer.Write(IgnoreAC); writer.Write(IgnoreMAC); writer.Write(DropProtect); writer.Write(SuperRefineLevel); } public uint Price() { if (Info == null) return 0; uint p = Info.Price; if (Info.Durability > 0&&Info.Type!=ItemType.Potion) { float r = ((Info.Price / 2F) / Info.Durability); p = (uint)(MaxDura * r); if (MaxDura > 0) r = CurrentDura / (float)MaxDura; else r = 0; p = (uint)Math.Floor(p / 2F + ((p / 2F) * r) + Info.Price / 2F); } p = (uint)(p * ((AC + MAC + DC + MC + SC + Accuracy + Agility + HP + MP + AttackSpeed + Luck + Strong + MagicResist + PoisonResist + HealthRecovery + ManaRecovery + PoisonRecovery + CriticalRate + CriticalDamage + Freezing + PoisonAttack) * 0.1F + 1F)); return p * Count; } public uint RepairPrice() { if (Info == null || Info.Durability == 0) return 0; uint p = Info.Price; if (Info.Durability > 0) { p = (uint)Math.Floor(MaxDura * ((Info.Price / 2F) / Info.Durability) + Info.Price / 2F); p = (uint)(p * ((AC + MAC + DC + MC + SC + Accuracy + Agility + HP + MP + AttackSpeed + Luck + Strong + MagicResist + PoisonResist + HealthRecovery + ManaRecovery + PoisonRecovery + CriticalRate + CriticalDamage + Freezing + PoisonAttack) * 0.1F + 1F)); } return (p * Count) - Price(); } public uint Quality() { uint q = (uint)(AC + MAC + DC + MC + SC + Accuracy + Agility + HP + MP + AttackSpeed + Luck + Strong + MagicResist + PoisonResist + HealthRecovery + ManaRecovery + PoisonRecovery + CriticalRate + CriticalDamage + Freezing + PoisonAttack + Awake.getAwakeLevel() + 1); return q; } public uint AwakeningPrice() { if (Info == null) return 0; uint p = 1500; p = (uint)((p * (1 + Awake.getAwakeLevel() * 2)) * (uint)Info.Grade); return p; } public uint DisassemblePrice() { if (Info == null) return 0; uint p = 1500 * (uint)Info.Grade; p = (uint)(p * ((AC + MAC + DC + MC + SC + Accuracy + Agility + HP + MP + AttackSpeed + Luck + Strong + MagicResist + PoisonResist + HealthRecovery + ManaRecovery + PoisonRecovery + CriticalRate + CriticalDamage + Freezing + PoisonAttack + Awake.getAwakeLevel()) * 0.1F + 1F)); return p; } public uint DowngradePrice() { if (Info == null) return 0; uint p = 3000; p = (uint)((p * (1 + (Awake.getAwakeLevel() + 1) * 2)) * (uint)Info.Grade); return p; } public uint ResetPrice() { if (Info == null) return 0; uint p = 3000 * (uint)Info.Grade; p = (uint)(p * ((AC + MAC + DC + MC + SC + Accuracy + Agility + HP + MP + AttackSpeed + Luck + Strong + MagicResist + PoisonResist + HealthRecovery + ManaRecovery + PoisonRecovery + CriticalRate + CriticalDamage + Freezing + PoisonAttack) * 0.2F + 1F)); return p; } public void SetSlotSize() //set slot size in db? { int amount = 0; switch (Info.Type) { case ItemType.Mount: if (Info.Shape < 7) amount = 4; else if (Info.Shape < 12) amount = 5; break; case ItemType.Weapon: if (Info.Shape == 49 || Info.Shape == 50) amount = 5; break; } if (amount == Slots.Length) return; Array.Resize(ref Slots, amount); } public ushort Image { get { switch (Info.Type) { case ItemType.Amulet: // if (Info.StackSize > 0) // { // switch (Info.Shape) // { // case 0: //Amulet // if (Count >= 300) return 3662; // if (Count >= 200) return 3661; // if (Count >= 100) return 3660; // return 3660; // case 1: //Grey Poison // if (Count >= 150) return 3675; // if (Count >= 100) return 2960; // if (Count >= 50) return 3674; // return 3673; // case 2: //Yellow Poison // if (Count >= 150) return 3672; // if (Count >= 100) return 2961; // if (Count >= 50) return 3671; // return 3670; // } // } break; } return Info.Image; } } public UserItem Clone() { UserItem item = new UserItem(Info) { UniqueID = UniqueID, CurrentDura = CurrentDura, MaxDura = MaxDura, Count = Count, AC = AC, MAC = MAC, DC = DC, MC = MC, SC = SC, Accuracy = Accuracy, Agility = Agility, BagWeight = BagWeight, WearWeight = WearWeight, HandWeight = HandWeight, FireAC = FireAC, WindAC = WindAC, IceAC = IceAC, LightAC = LightAC, HolyAC = HolyAC, DarkAC = DarkAC, PhantomAC = PhantomAC, FireMAC = FireMAC, WindMAC = WindMAC, IceMAC = IceMAC, LightMAC = LightMAC, HolyMAC = HolyMAC, DarkMAC = DarkMAC, PhantomMAC = PhantomMAC, IR = IR, IG = IG, IB = IB, WpLevelExp = WpLevelExp, HP = HP, MP = MP, AttackSpeed = AttackSpeed, Luck = Luck, DuraChanged = DuraChanged, SoulBoundId = SoulBoundId, Identified = Identified, Cursed = Cursed, Strong = Strong, MagicResist = MagicResist, PoisonResist = PoisonResist, HealthRecovery = HealthRecovery, ManaRecovery = ManaRecovery, PoisonRecovery = PoisonRecovery, CriticalRate = CriticalRate, CriticalDamage = CriticalDamage, Freezing = Freezing, PoisonAttack = PoisonAttack, Slots = Slots, Awake = Awake, AwakeType = AwakeType, RefinedValue = RefinedValue, RefineAdded = RefineAdded, Reflect = Reflect, MaxMacRate = MaxMacRate, MaxAcRate = MaxAcRate, ExpireInfo = ExpireInfo, MakeName = MakeName, Make = Make, Parry=Parry, IgnoreAC=IgnoreAC, IgnoreMAC=IgnoreMAC, DropProtect= DropProtect, SuperRefineLevel=SuperRefineLevel }; return item; } public void Resetstat() { AC = MAC = DC = MC = SC = Accuracy = Agility = HP = MP = Strong = MagicResist = PoisonResist = 0; AttackSpeed = Luck = 0; HealthRecovery = ManaRecovery = PoisonRecovery = CriticalRate = CriticalDamage = Freezing = PoisonAttack = 0; FireAC = WindAC = IceAC = LightAC = HolyAC = DarkAC = PhantomAC = 0; FireMAC = WindMAC = IceMAC = LightMAC = HolyMAC = DarkMAC = PhantomMAC = 0; BagWeight = WearWeight = HandWeight = 0; HideAC = HideMAC = HideDC = HideMC = HideSC = HideAccuracy = HideAgility = 0; BagWeight = WearWeight = HandWeight = 0; AwakeType = 0; RefineAdded = 0; IR = IG = IB = 0; SuperRefineLevel = 0; WpLevelExp = 0; Luck = 0; } public void Resetstatwp() { AC = MAC = DC = MC = SC = 0; // AttackSpeed = Luck = 0; FireAC = WindAC = IceAC = LightAC = HolyAC = DarkAC = PhantomAC = 0; FireMAC = WindMAC = IceMAC = LightMAC = HolyMAC = DarkMAC = PhantomMAC = 0; BagWeight = WearWeight = HandWeight = 0; HideAC = HideMAC = HideDC = HideMC = HideSC = HideAccuracy = HideAgility = 0; BagWeight = WearWeight = HandWeight = 0; IR = IG = IB = 0; SuperRefineLevel = 0; WpLevelExp = 0; } public void ReinfinResetstat() { Accuracy = 0; CriticalRate = PoisonResist = PoisonRecovery = CriticalDamage = Freezing = PoisonAttack = Reflect = MaxAcRate = MaxMacRate = 0; HealthRecovery = ManaRecovery = 0; RefineAdded = HP = 0; Parry = Reflect = IgnoreAC = IgnoreMAC = 0; } public void ReinfinClone(UserItem temp) { Accuracy = temp.Accuracy; CriticalRate = temp.CriticalRate; PoisonResist = temp.PoisonResist; PoisonRecovery = temp.PoisonRecovery; CriticalDamage = temp.CriticalDamage; Freezing = temp.Freezing; PoisonAttack = temp.PoisonAttack; Reflect = temp.Reflect; HealthRecovery = temp.HealthRecovery; ManaRecovery = temp.ManaRecovery; MaxAcRate = temp.MaxAcRate; MaxMacRate = temp.MaxMacRate; RefineAdded = temp.RefineAdded; HP = temp.HP; } } public class ExpireInfo { public DateTime ExpiryDate; public ExpireInfo() { } public ExpireInfo(BinaryReader reader, int version = int.MaxValue, int Customversion = int.MaxValue) { ExpiryDate = DateTime.FromBinary(reader.ReadInt64()); } public void Save(BinaryWriter writer) { writer.Write(ExpiryDate.ToBinary()); } } public class GameShopItem { public int ItemIndex; public int GIndex; public ItemInfo Info; public uint GoldPrice = 0; public uint CreditPrice = 0; public uint Count = 1; public string Class = ""; public string Category = ""; public int Stock = 0; public bool iStock = false; public bool Deal = false; public bool TopItem = false; public DateTime Date; public GameShopItem() { } //public GameShopItem(MySqlDataReader readerGameShopItem) //{ // ItemIndex = Convert.ToInt32(readerGameShopItem["ItemIndex"]); // GIndex = Convert.ToInt32(readerGameShopItem["GIndex"]); // GoldPrice = Convert.ToUInt32(readerGameShopItem["GoldPrice"]); // CreditPrice = Convert.ToUInt32(readerGameShopItem["CreditPrice"]); // Count = Convert.ToUInt32(readerGameShopItem["Count"]); // Class = readerGameShopItem["Class"].ToString(); // Category = readerGameShopItem["Category"].ToString(); // Stock = Convert.ToInt32(readerGameShopItem["Stock"]); // iStock = Convert.ToBoolean(readerGameShopItem["iStock"]); // Deal = Convert.ToBoolean(readerGameShopItem["Deal"]); // TopItem = Convert.ToBoolean(readerGameShopItem["TopItem"]); // Date = readerGameShopItem.GetDateTime(readerGameShopItem.GetOrdinal("Date")); //} public GameShopItem(BinaryReader reader, int version = int.MaxValue, int Customversion = int.MaxValue) { ItemIndex = reader.ReadInt32(); GIndex = reader.ReadInt32(); GoldPrice = reader.ReadUInt32(); CreditPrice = reader.ReadUInt32(); Count = reader.ReadUInt32(); Class = reader.ReadString(); Category = reader.ReadString(); Stock = reader.ReadInt32(); iStock = reader.ReadBoolean(); Deal = reader.ReadBoolean(); TopItem = reader.ReadBoolean(); Date = DateTime.FromBinary(reader.ReadInt64()); } public GameShopItem(BinaryReader reader, bool packet = false) { ItemIndex = reader.ReadInt32(); GIndex = reader.ReadInt32(); Info = new ItemInfo(reader); GoldPrice = reader.ReadUInt32(); CreditPrice = reader.ReadUInt32(); Count = reader.ReadUInt32(); Class = reader.ReadString(); Category = reader.ReadString(); Stock = reader.ReadInt32(); iStock = reader.ReadBoolean(); Deal = reader.ReadBoolean(); TopItem = reader.ReadBoolean(); Date = DateTime.FromBinary(reader.ReadInt64()); } public void Save(BinaryWriter writer, bool packet = false) { writer.Write(ItemIndex); writer.Write(GIndex); if (packet) Info.Save(writer); writer.Write(GoldPrice); writer.Write(CreditPrice); writer.Write(Count); writer.Write(Class); writer.Write(Category); writer.Write(Stock); writer.Write(iStock); writer.Write(Deal); writer.Write(TopItem); writer.Write(Date.ToBinary()); } public override string ToString() { return string.Format("{0}: {1}", GIndex, Info.Name); } } public class Awake { //Awake Option public static byte AwakeSuccessRate = 70; public static byte AwakeHitRate = 70; public static int MaxAwakeLevel = 6; public static byte Awake_WeaponRate = 1; public static byte Awake_HelmetRate = 1; public static byte Awake_ArmorRate = 5; public static byte AwakeChanceMin = 1; public static float[] AwakeMaterialRate = new float[4] { 1.0F, 1.0F, 1.0F, 1.0F }; public static byte[] AwakeChanceMax = new byte[4] { 1, 2, 3, 4 }; public static List[]> AwakeMaterials = new List[]>(); public AwakeType type; public List listAwake = new List(); public Awake(BinaryReader reader) { type = (AwakeType)reader.ReadByte(); int count = reader.ReadInt32(); for (int i = 0; i < count; i++) { listAwake.Add(reader.ReadByte()); } } public void Save(BinaryWriter writer) { writer.Write((byte)type); writer.Write(listAwake.Count); foreach (byte value in listAwake) { writer.Write(value); } } public Awake() { type = AwakeType.None; } public bool IsMaxLevel() { return listAwake.Count == Awake.MaxAwakeLevel; } public int getAwakeLevel() { return listAwake.Count; } public byte getAwakeValue() { byte total = 0; foreach (byte value in listAwake) { total += value; } return total; } public bool CheckAwakening(UserItem item, AwakeType type) { // if (item.Info.CanAwakening != true) return false; if (item.Info.Grade == ItemGrade.None) return false; if (item.RefineAdded > 5) return false; // if (IsMaxLevel()) return false; if (this.type == AwakeType.None) { if (item.Info.Type == ItemType.Weapon) { if (type == AwakeType.准确 || type == AwakeType.暴击率 || type == AwakeType.冰冻 || type == AwakeType.毒攻击) { this.type = type; return true; } else return false; } else if (item.Info.Type == ItemType.Helmet) { if (type == AwakeType.物防 || type == AwakeType.法防) { this.type = type; return true; } else return false; } else if (item.Info.Type == ItemType.Armour) { return false; } else return false; } else { if (this.type == type) return true; else return false; } } public int UpgradeAwake(UserItem item, AwakeType type, out bool[] isHit) { //return -1 condition error, -1 = dont upgrade, 0 = failed, 1 = Succeed, isHit = null; if (CheckAwakening(item, type) != true) return -1; Random rand = new Random(DateTime.Now.Millisecond); if (rand.Next(0, 100) <= AwakeSuccessRate) { isHit = Awakening(item); return 1; } else { int idx; isHit = makeHit(1, out idx); return 0; } } public int RemoveAwake() { if (listAwake.Count > 0) { listAwake.Remove(listAwake[listAwake.Count - 1]); if (listAwake.Count == 0) type = AwakeType.None; return 1; } else { type = AwakeType.None; return 0; } } public int getAwakeLevelValue(int i) { return listAwake[i]; } //public byte getDC() { return (type == AwakeType.破坏 ? getAwakeValue() : (byte)0); } //public byte getMC() { return (type == AwakeType.法攻 ? getAwakeValue() : (byte)0); } //public byte getSC() { return (type == AwakeType.道攻 ? getAwakeValue() : (byte)0); } public byte getAC() { return (type == AwakeType.物防 ? getAwakeValue() : (byte)0); } public byte getMAC() { return (type == AwakeType.法防 ? getAwakeValue() : (byte)0); } // public byte getHPMP() { return (type == AwakeType.HPMP ? getAwakeValue() : (byte)0); } private bool[] makeHit(int maxValue, out int makeValue) { float stepValue = (float)maxValue / 5.0f; float totalValue = 0.0f; bool[] isHit = new bool[5]; Random rand = new Random(DateTime.Now.Millisecond); for (int i = 0; i < 5; i++) { if (rand.Next(0, 100) < AwakeHitRate) { totalValue += stepValue; isHit[i] = true; } else { isHit[i] = false; } } makeValue = totalValue <= 1.0f ? 1 : (int)totalValue; return isHit; } private bool[] Awakening(UserItem item) { int minValue = AwakeChanceMin; int maxValue = (AwakeChanceMax[(int)item.Info.Grade - 1] < AwakeChanceMin) ? AwakeChanceMin : AwakeChanceMax[(int)item.Info.Grade - 1]; int result; bool[] returnValue = makeHit(maxValue, out result); switch (item.Info.Type) { case ItemType.Weapon: result *= (int)Awake_WeaponRate; break; case ItemType.Armour: result *= (int)Awake_ArmorRate; break; case ItemType.Helmet: result *= (int)Awake_HelmetRate; break; default: result = 0; break; } listAwake.Add((byte)result); return returnValue; } } public class ClientMagic { public Spell Spell; public byte BaseCost, LevelCost, Icon; public byte Level1, Level2, Level3; public ushort Need1, Need2, Need3; public byte Level, Key, Range; public ushort Experience; public bool IsTempSpell; public long CastTime, Delay; public ClientMagic() { } public ClientMagic(BinaryReader reader) { Spell = (Spell)reader.ReadByte(); BaseCost = reader.ReadByte(); LevelCost = reader.ReadByte(); Icon = reader.ReadByte(); Level1 = reader.ReadByte(); Level2 = reader.ReadByte(); Level3 = reader.ReadByte(); Need1 = reader.ReadUInt16(); Need2 = reader.ReadUInt16(); Need3 = reader.ReadUInt16(); Level = reader.ReadByte(); Key = reader.ReadByte(); Experience = reader.ReadUInt16(); Delay = reader.ReadInt64(); Range = reader.ReadByte(); CastTime = reader.ReadInt64(); } public void Save(BinaryWriter writer) { writer.Write((byte)Spell); writer.Write(BaseCost); writer.Write(LevelCost); writer.Write(Icon); writer.Write(Level1); writer.Write(Level2); writer.Write(Level3); writer.Write(Need1); writer.Write(Need2); writer.Write(Need3); writer.Write(Level); writer.Write(Key); writer.Write(Experience); writer.Write(Delay); writer.Write(Range); writer.Write(CastTime); } } public class ClientAuction { public ulong AuctionID; public UserItem Item; public string Seller = string.Empty; public uint Price; public DateTime ConsignmentDate; public bool IsUseGold; public string Message; public bool isSold, isGetBack; public ClientAuction() { } public ClientAuction(BinaryReader reader) { AuctionID = reader.ReadUInt64(); Item = new UserItem(reader); Seller = reader.ReadString(); Price = reader.ReadUInt32(); ConsignmentDate = DateTime.FromBinary(reader.ReadInt64()); IsUseGold=reader.ReadBoolean(); Message = reader.ReadString(); } public void Save(BinaryWriter writer) { writer.Write(AuctionID); Item.Save(writer); writer.Write(Seller); writer.Write(Price); writer.Write(ConsignmentDate.ToBinary()); writer.Write(IsUseGold); writer.Write(Message==null?"":Message); } } public class GClientAuction { public ulong AuctionID; public string Seller = string.Empty; public int Price; public DateTime ConsignmentDate; public GClientAuction() { } public GClientAuction(BinaryReader reader) { AuctionID = reader.ReadUInt64(); Seller = reader.ReadString(); Price = reader.ReadInt32(); ConsignmentDate = DateTime.FromBinary(reader.ReadInt64()); } public void Save(BinaryWriter writer) { writer.Write(AuctionID); writer.Write(Seller); writer.Write(Price); writer.Write(ConsignmentDate.ToBinary()); } } public class ClientQuestInfo { public int Index; public uint NPCIndex; public string Name, Group; public List Description = new List(); public List TaskDescription = new List(); public List CompletionDescription = new List(); public int MinLevelNeeded, MaxLevelNeeded; public int QuestNeeded; public RequiredClass ClassNeeded; public int GenderNeeded; public QuestType Type; public uint RewardGold; public uint RewardExp; public uint RewardCredit; public List RewardsFixedItem = new List(); public List RewardsSelectItem = new List(); public List RewardRandomItem =new List(); public uint FinishNPCIndex; public List KillTaskNames = new List(); public List KillTaskCounts=new List(); public List ItemTaskNames=new List(); public List ItemTaskCounts = new List(); public DateTime SeasonStartTime=DateTime.Now; public DateTime SeasonEndTime=DateTime.Now; public bool SameFinishNPC { get { return NPCIndex == FinishNPCIndex; } } public ClientQuestInfo() { } public ClientQuestInfo(BinaryReader reader) { Index = reader.ReadInt32(); NPCIndex = reader.ReadUInt32(); Name = reader.ReadString(); Group = reader.ReadString(); int count = reader.ReadInt32(); for (int i = 0; i < count; i++) Description.Add(reader.ReadString()); count = reader.ReadInt32(); for (int i = 0; i < count; i++) TaskDescription.Add(reader.ReadString()); count = reader.ReadInt32(); for (int i = 0; i < count; i++) CompletionDescription.Add(reader.ReadString()); MinLevelNeeded = reader.ReadInt32(); MaxLevelNeeded = reader.ReadInt32(); QuestNeeded = reader.ReadInt32(); ClassNeeded = (RequiredClass)reader.ReadByte(); GenderNeeded = reader.ReadInt32(); Type = (QuestType)reader.ReadByte(); RewardGold = reader.ReadUInt32(); RewardExp = reader.ReadUInt32(); RewardCredit = reader.ReadUInt32(); count = reader.ReadInt32(); for (int i = 0; i < count; i++) RewardsFixedItem.Add(new QuestItemReward(reader)); count = reader.ReadInt32(); for (int i = 0; i < count; i++) RewardsSelectItem.Add(new QuestItemReward(reader)); FinishNPCIndex = reader.ReadUInt32(); count = reader.ReadInt32(); for (int i = 0; i < count; i++) RewardRandomItem.Add(new QuestItemReward(reader)); count = reader.ReadInt32(); for (int i = 0; i < count; i++) KillTaskNames.Add(reader.ReadString()); count= reader.ReadInt32(); for (int i = 0; i < count; i++) KillTaskCounts.Add(reader.ReadInt32()); count = reader.ReadInt32(); for (int i = 0; i < count; i++) ItemTaskNames.Add(reader.ReadString()); count = reader.ReadInt32(); for (int i = 0; i < count; i++) ItemTaskCounts.Add(reader.ReadInt32()); SeasonStartTime = DateTime.FromBinary(reader.ReadInt64()); SeasonEndTime = DateTime.FromBinary(reader.ReadInt64()); } public void Save(BinaryWriter writer) { writer.Write(Index); writer.Write(NPCIndex); writer.Write(Name); writer.Write(Group); writer.Write(Description.Count); for (int i = 0; i < Description.Count; i++) writer.Write(Description[i]); writer.Write(TaskDescription.Count); for (int i = 0; i < TaskDescription.Count; i++) writer.Write(TaskDescription[i]); writer.Write(CompletionDescription.Count); for (int i = 0; i < CompletionDescription.Count; i++) writer.Write(CompletionDescription[i]); writer.Write(MinLevelNeeded); writer.Write(MaxLevelNeeded); writer.Write(QuestNeeded); writer.Write((byte)ClassNeeded); writer.Write(GenderNeeded); writer.Write((byte)Type); writer.Write(RewardGold); writer.Write(RewardExp); writer.Write(RewardCredit); writer.Write(RewardsFixedItem.Count); for (int i = 0; i < RewardsFixedItem.Count; i++) RewardsFixedItem[i].Save(writer); writer.Write(RewardsSelectItem.Count); for (int i = 0; i < RewardsSelectItem.Count; i++) RewardsSelectItem[i].Save(writer); writer.Write(FinishNPCIndex); writer.Write(RewardRandomItem.Count); for (int i = 0; i < RewardRandomItem.Count; i++) RewardRandomItem[i].Save(writer); writer.Write(KillTaskNames.Count); for (int i = 0; i < KillTaskNames.Count; i++) writer.Write(KillTaskNames[i]); writer.Write(KillTaskCounts.Count); for (int i = 0; i < KillTaskCounts.Count; i++) writer.Write(KillTaskCounts[i]); writer.Write(ItemTaskNames.Count); for (int i = 0; i < ItemTaskNames.Count; i++) writer.Write(ItemTaskNames[i]); writer.Write(ItemTaskCounts.Count); for (int i = 0; i < ItemTaskCounts.Count; i++) writer.Write(ItemTaskCounts[i]); writer.Write(SeasonStartTime.ToBinary()); writer.Write(SeasonEndTime.ToBinary()); } public QuestIcon GetQuestIcon(bool taken = false, bool completed = false) { QuestIcon icon = QuestIcon.None; switch (Type) { case QuestType.General: case QuestType.Repeatable: if (completed) icon = QuestIcon.QuestionYellow; else if (taken) icon = QuestIcon.QuestionWhite; else icon = QuestIcon.ExclamationYellow; break; case QuestType.Season: case QuestType.Daily: case QuestType.Random: if (completed) icon = QuestIcon.QuestionBlue; else if (taken) icon = QuestIcon.QuestionWhite; else icon = QuestIcon.ExclamationBlue; break; case QuestType.Story: if (completed) icon = QuestIcon.QuestionGreen; else if (taken) icon = QuestIcon.QuestionWhite; else icon = QuestIcon.ExclamationGreen; break; } return icon; } } public class ClientQuestProgress { public int Id; public ClientQuestInfo QuestInfo; public List TaskList = new List(); public bool Taken; public bool Completed; public bool New; public QuestIcon Icon { get { return QuestInfo.GetQuestIcon(Taken, Completed); } } public ClientQuestProgress() { } public ClientQuestProgress(BinaryReader reader) { Id = reader.ReadInt32(); int count = reader.ReadInt32(); for (int i = 0; i < count; i++) TaskList.Add(reader.ReadString()); Taken = reader.ReadBoolean(); Completed = reader.ReadBoolean(); New = reader.ReadBoolean(); } public void Save(BinaryWriter writer) { writer.Write(Id); writer.Write(TaskList.Count); for (int i = 0; i < TaskList.Count; i++) writer.Write(TaskList[i]); writer.Write(Taken); writer.Write(Completed); writer.Write(New); } } public class QuestItemReward { public ItemInfo Item; public uint Count = 1; public uint Power = 0; public QuestItemReward() { } public QuestItemReward(BinaryReader reader) { Item = new ItemInfo(reader); Count = reader.ReadUInt32(); Power = reader.ReadUInt32(); } public void Save(BinaryWriter writer) { Item.Save(writer); writer.Write(Count); writer.Write(Power); } public override string ToString() { return Item==null?"空":Item.Name; } } public class ClientMail { public ulong MailID; public string SenderName; public string Message; public bool Opened, Locked, CanReply, Collected; public DateTime DateSent; public uint Gold; public List Items = new List(); public ClientMail() { } public ClientMail(BinaryReader reader) { MailID = reader.ReadUInt64(); SenderName = reader.ReadString(); Message = reader.ReadString(); Opened = reader.ReadBoolean(); Locked = reader.ReadBoolean(); CanReply = reader.ReadBoolean(); Collected = reader.ReadBoolean(); DateSent = DateTime.FromBinary(reader.ReadInt64()); Gold = reader.ReadUInt32(); int count = reader.ReadInt32(); for (int i = 0; i < count; i++) Items.Add(new UserItem(reader)); } public void Save(BinaryWriter writer) { writer.Write(MailID); writer.Write(SenderName); writer.Write(Message); writer.Write(Opened); writer.Write(Locked); writer.Write(CanReply); writer.Write(Collected); writer.Write(DateSent.ToBinary()); writer.Write(Gold); writer.Write(Items.Count); for (int i = 0; i < Items.Count; i++) Items[i].Save(writer); } } public class ClientFriend { public int Index; public string Name; public string Memo = ""; public bool Blocked; public bool Online; public int Level; public string LoacateMap; public ClientFriend() { } public ClientFriend(BinaryReader reader) { Index = reader.ReadInt32(); Name = reader.ReadString(); Memo = reader.ReadString(); Blocked = reader.ReadBoolean(); Online = reader.ReadBoolean(); Level = reader.ReadInt32(); LoacateMap = reader.ReadString(); } public void Save(BinaryWriter writer) { writer.Write(Index); writer.Write(Name); writer.Write(Memo); writer.Write(Blocked); writer.Write(Online); writer.Write(Level); writer.Write(LoacateMap); } } public enum IntelligentCreaturePickupMode : byte { Automatic = 0, SemiAutomatic = 1, } public class IntelligentCreatureRules { public int MinimalFullness = 1; public bool MousePickupEnabled = false; public int MousePickupRange = 0; public bool AutoPickupEnabled = false; public int AutoPickupRange = 0; public bool SemiAutoPickupEnabled = false; public int SemiAutoPickupRange = 0; public bool CanProduceBlackStone = false; public string Info = ""; public string Info1 = ""; public string Info2 = ""; public IntelligentCreatureRules() { } public IntelligentCreatureRules(BinaryReader reader) { MinimalFullness = reader.ReadInt32(); MousePickupEnabled = reader.ReadBoolean(); MousePickupRange = reader.ReadInt32(); AutoPickupEnabled = reader.ReadBoolean(); AutoPickupRange = reader.ReadInt32(); SemiAutoPickupEnabled = reader.ReadBoolean(); SemiAutoPickupRange = reader.ReadInt32(); CanProduceBlackStone = reader.ReadBoolean(); Info = reader.ReadString(); Info1 = reader.ReadString(); Info2 = reader.ReadString(); } public void Save(BinaryWriter writer) { writer.Write(MinimalFullness); writer.Write(MousePickupEnabled); writer.Write(MousePickupRange); writer.Write(AutoPickupEnabled); writer.Write(AutoPickupRange); writer.Write(SemiAutoPickupEnabled); writer.Write(SemiAutoPickupRange); writer.Write(CanProduceBlackStone); writer.Write(Info); writer.Write(Info1); writer.Write(Info2); } } public class IntelligentCreatureItemFilter { public bool PetPickupAll = true; public bool PetPickupGold = false; public bool PetPickupWeapons = false; public bool PetPickupArmours = false; public bool PetPickupHelmets = false; public bool PetPickupBoots = false; public bool PetPickupBelts = false; public bool PetPickupAccessories = false; public bool PetPickupOthers = false; public ItemGrade PickupGrade = ItemGrade.None; public IntelligentCreatureItemFilter() { } public void SetItemFilter(int idx) { switch (idx) { case 0://all items PetPickupAll = true; PetPickupGold = false; PetPickupWeapons = false; PetPickupArmours = false; PetPickupHelmets = false; PetPickupBoots = false; PetPickupBelts = false; PetPickupAccessories = false; PetPickupOthers = false; break; case 1://gold PetPickupAll = false; PetPickupGold = !PetPickupGold; break; case 2://weapons PetPickupAll = false; PetPickupWeapons = !PetPickupWeapons; break; case 3://armours PetPickupAll = false; PetPickupArmours = !PetPickupArmours; break; case 4://helmets PetPickupAll = false; PetPickupHelmets = !PetPickupHelmets; break; case 5://boots PetPickupAll = false; PetPickupBoots = !PetPickupBoots; break; case 6://belts PetPickupAll = false; PetPickupBelts = !PetPickupBelts; break; case 7://jewelry PetPickupAll = false; PetPickupAccessories = !PetPickupAccessories; break; case 8://others PetPickupAll = false; PetPickupOthers = !PetPickupOthers; break; } if (PetPickupGold && PetPickupWeapons && PetPickupArmours && PetPickupHelmets && PetPickupBoots && PetPickupBelts && PetPickupAccessories && PetPickupOthers) { PetPickupAll = true; PetPickupGold = false; PetPickupWeapons = false; PetPickupArmours = false; PetPickupHelmets = false; PetPickupBoots = false; PetPickupBelts = false; PetPickupAccessories = false; PetPickupOthers = false; } else if (!PetPickupGold && !PetPickupWeapons && !PetPickupArmours && !PetPickupHelmets && !PetPickupBoots && !PetPickupBelts && !PetPickupAccessories && !PetPickupOthers) { PetPickupAll = true; } } public IntelligentCreatureItemFilter(BinaryReader reader) { PetPickupAll = reader.ReadBoolean(); PetPickupGold = reader.ReadBoolean(); PetPickupWeapons = reader.ReadBoolean(); PetPickupArmours = reader.ReadBoolean(); PetPickupHelmets = reader.ReadBoolean(); PetPickupBoots = reader.ReadBoolean(); PetPickupBelts = reader.ReadBoolean(); PetPickupAccessories = reader.ReadBoolean(); PetPickupOthers = reader.ReadBoolean(); //PickupGrade = (ItemGrade)reader.ReadByte(); } public void Save(BinaryWriter writer) { writer.Write(PetPickupAll); writer.Write(PetPickupGold); writer.Write(PetPickupWeapons); writer.Write(PetPickupArmours); writer.Write(PetPickupHelmets); writer.Write(PetPickupBoots); writer.Write(PetPickupBelts); writer.Write(PetPickupAccessories); writer.Write(PetPickupOthers); //writer.Write((byte)PickupGrade); } } public class ClientIntelligentCreature { public IntelligentCreatureType PetType; public int Icon; public string CustomName; public int Fullness; public int SlotIndex; public long ExpireTime;//in days public long BlackstoneTime; public long MaintainFoodTime; public IntelligentCreaturePickupMode petMode = IntelligentCreaturePickupMode.SemiAutomatic; public IntelligentCreatureRules CreatureRules; public IntelligentCreatureItemFilter Filter; public ClientIntelligentCreature() { } public ClientIntelligentCreature(BinaryReader reader) { PetType = (IntelligentCreatureType)reader.ReadByte(); Icon = reader.ReadInt32(); CustomName = reader.ReadString(); Fullness = reader.ReadInt32(); SlotIndex = reader.ReadInt32(); ExpireTime = reader.ReadInt64(); BlackstoneTime = reader.ReadInt64(); petMode = (IntelligentCreaturePickupMode)reader.ReadByte(); CreatureRules = new IntelligentCreatureRules(reader); Filter = new IntelligentCreatureItemFilter(reader); Filter.PickupGrade = (ItemGrade)reader.ReadByte(); MaintainFoodTime = reader.ReadInt64(); } public void Save(BinaryWriter writer) { writer.Write((byte)PetType); writer.Write(Icon); writer.Write(CustomName); writer.Write(Fullness); writer.Write(SlotIndex); writer.Write(ExpireTime); writer.Write(BlackstoneTime); writer.Write((byte)petMode); CreatureRules.Save(writer); Filter.Save(writer); writer.Write((byte)Filter.PickupGrade); writer.Write(MaintainFoodTime); } } public class ManagePacket { public string Type = "Lost"; public Object Data; } public class GiveItemPacket { public string ItemName; public int Count; public string PlayerName; } public class DeleteItemPacket { public ulong UniqueID; public uint OwnerID; public string Store; } public class SendItemToInventoryPacket { public ulong UniqueID; public uint OwnerID; public string Store; } public class SendItemToMailPacket { public ulong UniqueID; public uint OwnerID; public string Store; } public class EditDDropPacket { public uint PlayerID; public int Value; public string MonsterName; } public class EditItemPacket { public ulong UniqueID; public uint OwnerID; public string Store; public string ItemName; public int Position; public int Count; public int MC; public int SC; public int AC; public int DC; public int MAC; public int Accuracy; public int Agility; public int BagWeight; public int WearWeight; public int HandWeight; public int FireAC; public int WindAC; public int IceAC; public int LightAC; public int HolyAC; public int DarkAC; public int PhantomAC; public int FireMAC; public int WindMAC; public int IceMAC; public int LightMAC; public int HolyMAC; public int DarkMAC; public int PhantomMAC; public int IR; public int IG; public int IB; public int WpLevelExp; public int HP; public int MP; public int AttackSpeed; public int Luck; public int MagicResist; public int PoisonResist; public int HealthRecovery; public int ManaRecovery; public int PoisonRecovery; public int CriticalRate; public int CriticalDamage; public int Freezing; public int PoisonAttack; public int RefineAdded; public int Reflect; public int MaxAcRate; public int MaxMacRate; public int Parry; public int IgnoreAC; public int IgnoreMAC; public int DropProtect; } public class ManageMsgResult { public int StatusCode; public string Message; } public class KickPlayerPacket { public uint PlayerID; } public class BanPlayerPacket { public string AccountID; } public class UnbanPlayerPacket { public string AccountID; } public class SendHookQuestionPacket { public string AccountID; } public class ChangeHookSuspicionLevelPacket { public string AccountID; public int Value; } public class AddBannedAddressPacket { public int Type; public string Address; } public abstract class Packet { // public static byte IsServer; public static byte[] alive; public static uint pid = 1; public abstract ushort Index { get; } internal uint PID = 0; public Packet() { } public static Packet GetPacket(ushort index) { if (index <= 30000) { return GetClientPacket(index); } else if (index <= 60000) { return GetServerPacket(index); } else { return GetCustomPacket(index); } } public static Packet ReceivePacket(byte[] rawBytes, out byte[] extra) { extra = rawBytes; Packet p; if (rawBytes.Length < 4) return null; //| 2Bytes: Packet Size | 2Bytes: Packet ID | int length = (rawBytes[1] << 8) + rawBytes[0]; if (length > rawBytes.Length || length < 2) return null; using (MemoryStream stream = new MemoryStream(rawBytes, 2, length - 2)) using (BinaryReader reader = new BinaryReader(stream)) { try { stream.Seek(1, SeekOrigin.Begin); uint xh = reader.ReadUInt32(); ushort id = reader.ReadUInt16(); if (id == (ushort)ClientPacketIds.MoveShield) { Console.Write("AAA"); } p = GetPacket(id); if (p == null) return null; p.PID = xh; p.ReadPacket(reader); } catch { extra = new byte[0]; return null; } } extra = new byte[rawBytes.Length - length]; System.Buffer.BlockCopy(rawBytes, length, extra, 0, rawBytes.Length - length); return p; } public IEnumerable GetPacketBytes(object peer = null) { if (Index < 0) return new byte[0]; byte[] data; using (MemoryStream stream = new MemoryStream()) { stream.SetLength(2); stream.Seek(2, SeekOrigin.Begin); using (BinaryWriter writer = new BinaryWriter(stream)) { writer.Write((byte)0); if (PID == 0) PID = pid++; writer.Write(PID); writer.Write(Index); WritePacket(writer); stream.Seek(0, SeekOrigin.Begin); writer.Write((short)stream.Length); stream.Seek(0, SeekOrigin.Begin); data = new byte[stream.Length]; stream.Read(data, 0, data.Length); aliveData(data, (byte[])peer); } } return data; } protected void aliveData(byte[] ak, byte[] peer) { byte[] student; if (Index > 30000) { return; } else { student = peer == null ? alive : peer; } if (student == null) { return; } else { ak[2] = 1; // byte car = 0; for (int i = 3; i < ak.Length; i++) { // car = (byte)(ak[i] ^ car); ak[i] = (byte)(ak[i] ^ student[i % 8]); } // ak[ak.Length] = (byte)(car ^ student[4] ^ student[5]); } } protected void setAlive(byte[] value) { setAlive(value); } protected abstract void ReadPacket(BinaryReader reader); protected abstract void WritePacket(BinaryWriter writer); //服务端获得数据包并返回数据包函数 private static Packet GetClientPacket(ushort index) { //if (index != (short)ClientPacketIds.KeepAlive && index != (short)ClientPacketIds.PickUp) //{ // Console.WriteLine("111"); //} switch (index) { case (ushort)ClientPacketIds.ClientVersion: return new C.ClientVersion(); case (ushort)ClientPacketIds.Disconnect: return new C.Disconnect(); case (ushort)ClientPacketIds.KeepAlive: return new C.KeepAlive(); case (ushort)ClientPacketIds.EnterAlive: return new C.EnterAlive(); case (ushort)ClientPacketIds.NewAccount: return new C.NewAccount(); case (ushort)ClientPacketIds.ChangePassword: return new C.ChangePassword(); case (ushort)ClientPacketIds.Login: return new C.Login(); case (ushort)ClientPacketIds.LoginAccount: return new C.LoginAccount(); case (ushort)ClientPacketIds.NewCharacter: return new C.NewCharacter(); case (ushort)ClientPacketIds.DeleteCharacter: return new C.DeleteCharacter(); case (ushort)ClientPacketIds.StartGame: return new C.StartGame(); case (ushort)ClientPacketIds.LogOut: return new C.LogOut(); case (ushort)ClientPacketIds.Turn: return new C.Turn(); case (ushort)ClientPacketIds.Walk: return new C.Walk(); case (ushort)ClientPacketIds.Run: return new C.Run(); case (ushort)ClientPacketIds.Chat: return new C.Chat(); case (ushort)ClientPacketIds.MoveItem: return new C.MoveItem(); case (ushort)ClientPacketIds.StoreItem: return new C.StoreItem(); case (ushort)ClientPacketIds.SendStorPassword: return new C.SendStorPassword(); case (ushort)ClientPacketIds.SetStorPassword: return new C.SetStorPassword(); case (ushort)ClientPacketIds.CancelPassword: return new C.CancelPassword(); case (ushort)ClientPacketIds.BuyStorage: return new C.BuyStorage(); case (ushort)ClientPacketIds.UseHorn: return new C.UseHorn(); case (ushort)ClientPacketIds.TakeBackItem: return new C.TakeBackItem(); case (ushort)ClientPacketIds.MergeItem: return new C.MergeItem(); case (ushort)ClientPacketIds.EquipItem: return new C.EquipItem(); case (ushort)ClientPacketIds.RemoveItem: return new C.RemoveItem(); case (ushort)ClientPacketIds.RemoveSlotItem: return new C.RemoveSlotItem(); case (ushort)ClientPacketIds.SplitItem: return new C.SplitItem(); case (ushort)ClientPacketIds.UseItem: return new C.UseItem(); case (ushort)ClientPacketIds.DropItem: return new C.DropItem(); case (ushort)ClientPacketIds.DepositRefineItem: return new C.DepositRefineItem(); case (ushort)ClientPacketIds.RetrieveRefineItem: return new C.RetrieveRefineItem(); case (ushort)ClientPacketIds.RefineCancel: return new C.RefineCancel(); case (ushort)ClientPacketIds.RefineItem: return new C.RefineItem(); case (ushort)ClientPacketIds.CheckRefine: return new C.CheckRefine(); case (ushort)ClientPacketIds.ReplaceWedRing: return new C.ReplaceWedRing(); case (ushort)ClientPacketIds.DepositTradeItem: return new C.DepositTradeItem(); case (ushort)ClientPacketIds.RetrieveTradeItem: return new C.RetrieveTradeItem(); case (ushort)ClientPacketIds.DropGold: return new C.DropGold(); case (ushort)ClientPacketIds.PickUp: return new C.PickUp(); case (ushort)ClientPacketIds.Inspect: return new C.Inspect(); case (ushort)ClientPacketIds.ChangeAMode: return new C.ChangeAMode(); case (ushort)ClientPacketIds.ChangePMode: return new C.ChangePMode(); case (ushort)ClientPacketIds.ChangeHelmetoff: return new C.ChangeHelmetoff(); case (ushort)ClientPacketIds.ChangeTrade: return new C.ChangeTrade(); case (ushort)ClientPacketIds.Attack: return new C.Attack(); case (ushort)ClientPacketIds.RangeAttack: return new C.RangeAttack(); case (ushort)ClientPacketIds.Harvest: return new C.Harvest(); case (ushort)ClientPacketIds.CallNPC: return new C.CallNPC(); case (ushort)ClientPacketIds.TalkMonsterNPC: return new C.TalkMonsterNPC(); case (ushort)ClientPacketIds.BuyItem: return new C.BuyItem(); case (ushort)ClientPacketIds.GetSelectItem: return new C.GetSelectItem(); case (ushort)ClientPacketIds.SellItem: return new C.SellItem(); case (ushort)ClientPacketIds.RepairItem: return new C.RepairItem(); case (ushort)ClientPacketIds.BuyItemBack: return new C.BuyItemBack(); case (ushort)ClientPacketIds.GetAllhp: return new C.GetAllhp(); case (ushort)ClientPacketIds.FindItem: return new C.FindItem(); case (ushort)ClientPacketIds.PoisonChangaChanged: return new C.PoisonChangaChanged(); case (ushort)ClientPacketIds.SRepairItem: return new C.SRepairItem(); case (ushort)ClientPacketIds.MagicKey: return new C.MagicKey(); case (ushort)ClientPacketIds.Magic: return new C.Magic(); case (ushort)ClientPacketIds.SwitchGroup: return new C.SwitchGroup(); case (ushort)ClientPacketIds.AddMember: return new C.AddMember(); case (ushort)ClientPacketIds.DellMember: return new C.DelMember(); case (ushort)ClientPacketIds.GroupInvite: return new C.GroupInvite(); case (ushort)ClientPacketIds.TownRevive: return new C.TownRevive(); case (ushort)ClientPacketIds.SpellToggle: return new C.SpellToggle(); case (ushort)ClientPacketIds.ConsignItem: return new C.ConsignItem(); case (ushort)ClientPacketIds.MarketSearch: return new C.MarketSearch(); case (ushort)ClientPacketIds.MarketSearch2: return new C.MarketSearch2(); case (ushort)ClientPacketIds.ItemAuctionSearch: return new C.ItemAuctionSearch(); case (ushort)ClientPacketIds.MyAuctionSearch: return new C.MyAuctionSearch(); case (ushort)ClientPacketIds.MarketGroupSearch: return new C.MarketGroupSearch(); case (ushort)ClientPacketIds.GameShopSearch: return new C.GameShopSearch(); case (ushort)ClientPacketIds.ExchangeSend: return new C.ExchangeSend(); case (ushort)ClientPacketIds.MACUpgradeSend: return new C.MACUpgradeSend(); case (ushort)ClientPacketIds.ClearMACUpgradeSend: return new C.ClearMACUpgradeSend(); case (ushort)ClientPacketIds.DropProtectUpgradeSend: return new C.DropProtectUpgradeSend(); case (ushort)ClientPacketIds.BuyGameShopItem: return new C.BuyGameShopItem(); case (ushort)ClientPacketIds.MarketRefresh: return new C.MarketRefresh(); case (ushort)ClientPacketIds.MarketPage: return new C.MarketPage(); case (ushort)ClientPacketIds.MarketBuy: return new C.MarketBuy(); case (ushort)ClientPacketIds.MarketGetBack: return new C.MarketGetBack(); case (ushort)ClientPacketIds.RequestUserName: return new C.RequestUserName(); case (ushort)ClientPacketIds.RequestChatItem: return new C.RequestChatItem(); case (ushort)ClientPacketIds.HookQuestionRespose: return new C.HookQuestionRespose(); case (ushort)ClientPacketIds.EditGuildMember: return new C.EditGuildMember(); case (ushort)ClientPacketIds.GetAllGuild: return new C.GetAllGuild(); case (ushort)ClientPacketIds.GetAllJoinRequest: return new C.GetAllJoinRequest(); case (ushort)ClientPacketIds.ResposeJoinGuild: return new C.ResposeJoinGuild(); case (ushort)ClientPacketIds.RequestJoinGuild: return new C.RequestJoinGuild(); case (ushort)ClientPacketIds.EditGuildNotice: return new C.EditGuildNotice(); case (ushort)ClientPacketIds.GuildInvite: return new C.GuildInvite(); case (ushort)ClientPacketIds.GuildNameReturn: return new C.GuildNameReturn(); case (ushort)ClientPacketIds.RequestGuildInfo: return new C.RequestGuildInfo(); case (ushort)ClientPacketIds.GuildStorageGoldChange: return new C.GuildStorageGoldChange(); case (ushort)ClientPacketIds.GuildStorageItemChange: return new C.GuildStorageItemChange(); case (ushort)ClientPacketIds.GuildWarReturn: return new C.GuildWarReturn(); case (ushort)ClientPacketIds.MarriageRequest: return new C.MarriageRequest(); case (ushort)ClientPacketIds.MarriageReply: return new C.MarriageReply(); case (ushort)ClientPacketIds.ChangeMarriage: return new C.ChangeMarriage(); case (ushort)ClientPacketIds.ChangeName: return new C.ChangeName(); case (ushort)ClientPacketIds.DivorceRequest: return new C.DivorceRequest(); case (ushort)ClientPacketIds.DivorceReply: return new C.DivorceReply(); case (ushort)ClientPacketIds.AddMentor: return new C.AddMentor(); case (ushort)ClientPacketIds.MentorReply: return new C.MentorReply(); case (ushort)ClientPacketIds.AllowMentor: return new C.AllowMentor(); case (ushort)ClientPacketIds.CancelMentor: return new C.CancelMentor(); case (ushort)ClientPacketIds.TradeRequest: return new C.TradeRequest(); case (ushort)ClientPacketIds.TradeReply: return new C.TradeReply(); case (ushort)ClientPacketIds.TradeGold: return new C.TradeGold(); case (ushort)ClientPacketIds.TradeConfirm: return new C.TradeConfirm(); case (ushort)ClientPacketIds.TradeCancel: return new C.TradeCancel(); case (ushort)ClientPacketIds.EquipSlotItem: return new C.EquipSlotItem(); case (ushort)ClientPacketIds.FishingCast: return new C.FishingCast(); case (ushort)ClientPacketIds.FishingChangeAutocast: return new C.FishingChangeAutocast(); case (ushort)ClientPacketIds.AcceptQuest: return new C.AcceptQuest(); case (ushort)ClientPacketIds.FinishQuest: return new C.FinishQuest(); case (ushort)ClientPacketIds.AbandonQuest: return new C.AbandonQuest(); case (ushort)ClientPacketIds.ShareQuest: return new C.ShareQuest(); case (ushort)ClientPacketIds.AcceptReincarnation: return new C.AcceptReincarnation(); case (ushort)ClientPacketIds.CancelReincarnation: return new C.CancelReincarnation(); case (ushort)ClientPacketIds.CombineItem: return new C.CombineItem(); case (ushort)ClientPacketIds.SetConcentration: return new C.SetConcentration(); case (ushort)ClientPacketIds.AwakeningNeedMaterials: return new C.AwakeningNeedMaterials(); case (ushort)ClientPacketIds.DropProtectNeedMaterials: return new C.DropProtectNeedMaterials(); case (ushort)ClientPacketIds.AwakeningLockedItem: return new C.AwakeningLockedItem(); case (ushort)ClientPacketIds.Awakening: return new C.Awakening(); case (ushort)ClientPacketIds.UnAwakening: return new C.UnAwakening(); case (ushort)ClientPacketIds.DisassembleItem: return new C.DisassembleItem(); case (ushort)ClientPacketIds.DowngradeAwakening: return new C.DowngradeAwakening(); case (ushort)ClientPacketIds.ResetAddedItem: return new C.ResetAddedItem(); case (ushort)ClientPacketIds.SendMail: return new C.SendMail(); case (ushort)ClientPacketIds.ReadMail: return new C.ReadMail(); case (ushort)ClientPacketIds.CollectParcel: return new C.CollectParcel(); case (ushort)ClientPacketIds.DeleteMail: return new C.DeleteMail(); case (ushort)ClientPacketIds.LockMail: return new C.LockMail(); case (ushort)ClientPacketIds.MailLockedItem: return new C.MailLockedItem(); case (ushort)ClientPacketIds.MailCost: return new C.MailCost(); case (ushort)ClientPacketIds.UpdateIntelligentCreature://IntelligentCreature return new C.UpdateIntelligentCreature(); case (ushort)ClientPacketIds.IntelligentCreaturePickup://IntelligentCreature return new C.IntelligentCreaturePickup(); case (ushort)ClientPacketIds.AddFriend: return new C.AddFriend(); case (ushort)ClientPacketIds.AddFriendRespose: return new C.AddFriendRespose(); case (ushort)ClientPacketIds.RemoveFriend: return new C.RemoveFriend(); case (ushort)ClientPacketIds.RefreshFriends: return new C.RefreshFriends(); case (ushort)ClientPacketIds.AddMemo: return new C.AddMemo(); case (ushort)ClientPacketIds.GuildBuffUpdate: return new C.GuildBuffUpdate(); case (ushort)ClientPacketIds.GameshopBuy: return new C.GameshopBuy(); case (ushort)ClientPacketIds.NPCConfirmInput: return new C.NPCConfirmInput(); case (ushort)ClientPacketIds.QueryMapNPCs: return new C.QueryMapNPCs(); case (ushort)ClientPacketIds.QueryAllMaps: return new C.QueryAllMaps(); case (ushort)ClientPacketIds.ReportIssue: return new C.ReportIssue(); case (ushort)ClientPacketIds.GetRanking: return new C.GetRanking(); case (ushort)ClientPacketIds.Opendoor: return new C.Opendoor(); case (ushort)ClientPacketIds.PayMail: return new C.PayMail(); case (ushort)ClientPacketIds.RefreshRecipe: return new C.RefreshRecipe(); case (ushort)ClientPacketIds.VersionName: return new C.VersionName(); case (ushort)ClientPacketIds.InitialItem: return new C.InitialItem(); case (ushort)ClientPacketIds.MoveShield: return new C.MoveShield(); case (ushort)ClientPacketIds.PrepareMoveShield: return new C.PrepareMoveShield(); default: return null; } } private static Packet GetCustomPacket(ushort index) { switch (index) { case (ushort)CustomPacketIds.Manager: return new C.Manager(); default: return null; } } private static Packet GetServerPacket(ushort index) { switch (index) { case (ushort)ServerPacketIds.Connected: return new S.Connected(); case (ushort)ServerPacketIds.ClientVersion: return new S.ClientVersion(); case (ushort)ServerPacketIds.Disconnect: return new S.Disconnect(); case (ushort)ServerPacketIds.KeepAlive: return new S.KeepAlive(); case (ushort)ServerPacketIds.HookSuspicionMsg: return new S.HookSuspicionMsg(); case (ushort)ServerPacketIds.HookSuspicionMsgFailure: return new S.HookSuspicionMsgFailure(); case (ushort)ServerPacketIds.NewAccount: return new S.NewAccount(); case (ushort)ServerPacketIds.ChangePassword: return new S.ChangePassword(); case (ushort)ServerPacketIds.ChangePasswordBanned: return new S.ChangePasswordBanned(); case (ushort)ServerPacketIds.Login: return new S.Login(); case (ushort)ServerPacketIds.LoginBanned: return new S.LoginBanned(); case (ushort)ServerPacketIds.LoginSuccess: return new S.LoginSuccess(); case (ushort)ServerPacketIds.NewCharacter: return new S.NewCharacter(); case (ushort)ServerPacketIds.NewCharacterSuccess: return new S.NewCharacterSuccess(); case (ushort)ServerPacketIds.DeleteCharacter: return new S.DeleteCharacter(); case (ushort)ServerPacketIds.DeleteCharacterSuccess: return new S.DeleteCharacterSuccess(); case (ushort)ServerPacketIds.StartGame: return new S.StartGame(); case (ushort)ServerPacketIds.StartGameBanned: return new S.StartGameBanned(); case (ushort)ServerPacketIds.StartGameDelay: return new S.StartGameDelay(); case (ushort)ServerPacketIds.EnterAlive: return new S.EnterAlive(); case (ushort)ServerPacketIds.MapInformation: return new S.MapInformation(); case (ushort)ServerPacketIds.UserInformation: return new S.UserInformation(); case (ushort)ServerPacketIds.UserLocation: return new S.UserLocation(); case (ushort)ServerPacketIds.ObjectPlayer: return new S.ObjectPlayer(); case (ushort)ServerPacketIds.ObjectRemove: return new S.ObjectRemove(); case (ushort)ServerPacketIds.ObjectTurn: return new S.ObjectTurn(); case (ushort)ServerPacketIds.ObjectWalk: return new S.ObjectWalk(); case (ushort)ServerPacketIds.ObjectRun: return new S.ObjectRun(); case (ushort)ServerPacketIds.Chat: return new S.Chat(); case (ushort)ServerPacketIds.ObjectChat: return new S.ObjectChat(); case (ushort)ServerPacketIds.NewItemInfo: return new S.NewItemInfo(); case (ushort)ServerPacketIds.MoveItem: return new S.MoveItem(); case (ushort)ServerPacketIds.EquipItem: return new S.EquipItem(); case (ushort)ServerPacketIds.MergeItem: return new S.MergeItem(); case (ushort)ServerPacketIds.RemoveItem: return new S.RemoveItem(); case (ushort)ServerPacketIds.RemoveSlotItem: return new S.RemoveSlotItem(); case (ushort)ServerPacketIds.TakeBackItem: return new S.TakeBackItem(); case (ushort)ServerPacketIds.StoreItem: return new S.StoreItem(); case (ushort)ServerPacketIds.SureBuyStorage: return new S.SureBuyStorage(); case (ushort)ServerPacketIds.StorPasswordAuthResult: return new S.StorPasswordAuthResult(); case (ushort)ServerPacketIds.ReceiveMessageBox: return new S.ReceiveMessageBox(); case (ushort)ServerPacketIds.SetStoragePassword: return new S.SetStoragePassword(); case (ushort)ServerPacketIds.StorPasswordAsk: return new S.StorPasswordAsk(); case (ushort)ServerPacketIds.DepositRefineItem: return new S.DepositRefineItem(); case (ushort)ServerPacketIds.RetrieveRefineItem: return new S.RetrieveRefineItem(); case (ushort)ServerPacketIds.RefineItem: return new S.RefineItem(); case (ushort)ServerPacketIds.Mir3RefineItem: return new S.Mir3RefineItem(); case (ushort)ServerPacketIds.Mir3AtkRefine: return new S.Mir3AtkRefine(); case (ushort)ServerPacketIds.ClientHP: return new S.ClientHP(); case (ushort)ServerPacketIds.FindBlackItem: return new S.FindBlackItem(); case (ushort)ServerPacketIds.DepositTradeItem: return new S.DepositTradeItem(); case (ushort)ServerPacketIds.RetrieveTradeItem: return new S.RetrieveTradeItem(); case (ushort)ServerPacketIds.SplitItem: return new S.SplitItem(); case (ushort)ServerPacketIds.SplitItem1: return new S.SplitItem1(); case (ushort)ServerPacketIds.UseItem: return new S.UseItem(); case (ushort)ServerPacketIds.DropItem: return new S.DropItem(); case (ushort)ServerPacketIds.PlayerUpdate: return new S.PlayerUpdate(); case (ushort)ServerPacketIds.PlayerInspect: return new S.PlayerInspect(); case (ushort)ServerPacketIds.LogOutSuccess: return new S.LogOutSuccess(); case (ushort)ServerPacketIds.LogOutFailed: return new S.LogOutFailed(); case (ushort)ServerPacketIds.TimeOfDay: return new S.TimeOfDay(); case (ushort)ServerPacketIds.ChangeAMode: return new S.ChangeAMode(); case (ushort)ServerPacketIds.ChangePMode: return new S.ChangePMode(); case (ushort)ServerPacketIds.ObjectUseItem: return new S.ObjectUseItem(); case (ushort)ServerPacketIds.DropProtectSuccess: return new S.DropProtectSuccess(); case (ushort)ServerPacketIds.ObjectItem: return new S.ObjectItem(); case (ushort)ServerPacketIds.ObjectGold: return new S.ObjectGold(); case (ushort)ServerPacketIds.GainedItem: return new S.GainedItem(); case (ushort)ServerPacketIds.GainedGold: return new S.GainedGold(); case (ushort)ServerPacketIds.LoseGold: return new S.LoseGold(); case (ushort)ServerPacketIds.GainedCredit: return new S.GainedCredit(); case (ushort)ServerPacketIds.LoseCredit: return new S.LoseCredit(); case (ushort)ServerPacketIds.ObjectMonster: return new S.ObjectMonster(); case (ushort)ServerPacketIds.ObjectAttack: return new S.ObjectAttack(); case (ushort)ServerPacketIds.Struck: return new S.Struck(); case (ushort)ServerPacketIds.DamageIndicator: return new S.DamageIndicator(); case (ushort)ServerPacketIds.ObjectStruck: return new S.ObjectStruck(); case (ushort)ServerPacketIds.DuraChanged: return new S.DuraChanged(); case (ushort)ServerPacketIds.PoisonChangaChanged: return new S.PoisonChangaChanged(); case (ushort)ServerPacketIds.HealthChanged: return new S.HealthChanged(); case (ushort)ServerPacketIds.DeleteItem: return new S.DeleteItem(); case (ushort)ServerPacketIds.Death: return new S.Death(); case (ushort)ServerPacketIds.ObjectDied: return new S.ObjectDied(); case (ushort)ServerPacketIds.ColorChanged: return new S.ColorChanged(); case (ushort)ServerPacketIds.ObjectColorChanged: return new S.ObjectColorChanged(); case (ushort)ServerPacketIds.ObjectGuildNameChanged: return new S.ObjectGuildNameChanged(); case (ushort)ServerPacketIds.GainExperience: return new S.GainExperience(); case (ushort)ServerPacketIds.SubExperience: return new S.SubExperience(); case (ushort)ServerPacketIds.LevelChanged: return new S.LevelChanged(); case (ushort)ServerPacketIds.ExtraChanged: return new S.ExtraChanged(); case (ushort)ServerPacketIds.ObjectLeveled: return new S.ObjectLeveled(); case (ushort)ServerPacketIds.ObjectWpLeveled: return new S.ObjectWpLeveled(); case (ushort)ServerPacketIds.ObjectShowHelmet: return new S.ObjectShowHelmet(); case (ushort)ServerPacketIds.ObjectHarvest: return new S.ObjectHarvest(); case (ushort)ServerPacketIds.ObjectHarvested: return new S.ObjectHarvested(); case (ushort)ServerPacketIds.ObjectNpc: return new S.ObjectNPC(); case (ushort)ServerPacketIds.QueryMapNPCs: return new S.QueryMapNPCs(); case (ushort)ServerPacketIds.QueryAllMaps: return new S.QueryAllMaps(); case (ushort)ServerPacketIds.NPCResponse: return new S.NPCResponse(); case (ushort)ServerPacketIds.NPCDocument: return new S.NPCDocument(); case (ushort)ServerPacketIds.ObjectHide: return new S.ObjectHide(); case (ushort)ServerPacketIds.ObjectShow: return new S.ObjectShow(); case (ushort)ServerPacketIds.Poisoned: return new S.Poisoned(); case (ushort)ServerPacketIds.ObjectPoisoned: return new S.ObjectPoisoned(); case (ushort)ServerPacketIds.MapChanged: return new S.MapChanged(); case (ushort)ServerPacketIds.ObjectTeleportOut: return new S.ObjectTeleportOut(); case (ushort)ServerPacketIds.ObjectTeleportIn: return new S.ObjectTeleportIn(); case (ushort)ServerPacketIds.TeleportIn: return new S.TeleportIn(); case (ushort)ServerPacketIds.NPCGoods: return new S.NPCGoods(); case (ushort)ServerPacketIds.NPCSelectGoods: return new S.NPCSelectGoods(); case (ushort)ServerPacketIds.NPCSell: return new S.NPCSell(); case (ushort)ServerPacketIds.NPCRepair: return new S.NPCRepair(); case (ushort)ServerPacketIds.NPCSRepair: return new S.NPCSRepair(); case (ushort)ServerPacketIds.NPCRefine: return new S.NPCRefine(); case (ushort)ServerPacketIds.NPCCheckRefine: return new S.NPCCheckRefine(); case (ushort)ServerPacketIds.NPCCollectRefine: return new S.NPCCollectRefine(); case (ushort)ServerPacketIds.NPCReplaceWedRing: return new S.NPCReplaceWedRing(); case (ushort)ServerPacketIds.NPCStorage: return new S.NPCStorage(); case (ushort)ServerPacketIds.StartMACUpgrade: return new S.StartMACUpgrade(); case (ushort)ServerPacketIds.ClearMACUpgrade: return new S.ClearMACUpgrade(); case (ushort)ServerPacketIds.MACUpgradeResult: return new S.MACUpgradeResult(); case (ushort)ServerPacketIds.SellItem: return new S.SellItem(); case (ushort)ServerPacketIds.RepairItem: return new S.RepairItem(); case (ushort)ServerPacketIds.ItemRepaired: return new S.ItemRepaired(); case (ushort)ServerPacketIds.NewMagic: return new S.NewMagic(); case (ushort)ServerPacketIds.MagicLeveled: return new S.MagicLeveled(); case (ushort)ServerPacketIds.Magic: return new S.Magic(); case (ushort)ServerPacketIds.MagicDelay: return new S.MagicDelay(); case (ushort)ServerPacketIds.MagicCast: return new S.MagicCast(); case (ushort)ServerPacketIds.ObjectMagic: return new S.ObjectMagic(); case (ushort)ServerPacketIds.ObjectEffect: return new S.ObjectEffect(); case (ushort)ServerPacketIds.RangeAttack: return new S.RangeAttack(); case (ushort)ServerPacketIds.Pushed: return new S.Pushed(); case (ushort)ServerPacketIds.ObjectPushed: return new S.ObjectPushed(); case (ushort)ServerPacketIds.ObjectName: return new S.ObjectName(); case (ushort)ServerPacketIds.UserStorage: return new S.UserStorage(); case (ushort)ServerPacketIds.SwitchGroup: return new S.SwitchGroup(); case (ushort)ServerPacketIds.DeleteGroup: return new S.DeleteGroup(); case (ushort)ServerPacketIds.DeleteMember: return new S.DeleteMember(); case (ushort)ServerPacketIds.MemberLocation: return new S.MemberLocation(); case (ushort)ServerPacketIds.GroupInvite: return new S.GroupInvite(); case (ushort)ServerPacketIds.AddMember: return new S.AddMember(); case (ushort)ServerPacketIds.Revived: return new S.Revived(); case (ushort)ServerPacketIds.ObjectRevived: return new S.ObjectRevived(); case (ushort)ServerPacketIds.SpellToggle: return new S.SpellToggle(); case (ushort)ServerPacketIds.ObjectHealth: return new S.ObjectHealth(); case (ushort)ServerPacketIds.MapEffect: return new S.MapEffect(); case (ushort)ServerPacketIds.ObjectRangeAttack: return new S.ObjectRangeAttack(); case (ushort)ServerPacketIds.AddBuff: return new S.AddBuff(); case (ushort)ServerPacketIds.RemoveBuff: return new S.RemoveBuff(); case (ushort)ServerPacketIds.ObjectHidden: return new S.ObjectHidden(); case (ushort)ServerPacketIds.ObjectSpHidden: return new S.ObjectSpHidden(); case (ushort)ServerPacketIds.RefreshItem: return new S.RefreshItem(); case (ushort)ServerPacketIds.RefreshHair: return new S.RefreshHair(); case (ushort)ServerPacketIds.ObjectRefreshHair: return new S.ObjectRefreshHair(); case (ushort)ServerPacketIds.ObjectSpell: return new S.ObjectSpell(); case (ushort)ServerPacketIds.UserDash: return new S.UserDash(); case (ushort)ServerPacketIds.ObjectDash: return new S.ObjectDash(); case (ushort)ServerPacketIds.UserDashFail: return new S.UserDashFail(); case (ushort)ServerPacketIds.ObjectDashFail: return new S.ObjectDashFail(); case (ushort)ServerPacketIds.NPCConsign: return new S.NPCConsign(); case (ushort)ServerPacketIds.ZanZhuChangeName: return new S.ZanZhuChangeName(); case (ushort)ServerPacketIds.NPCMarket: return new S.NPCMarket(); case (ushort)ServerPacketIds.NPCMarketPage: return new S.NPCMarketPage(); case (ushort)ServerPacketIds.AuctionGroups: return new S.AuctionGroups(); case (ushort)ServerPacketIds.GameShopSearch: return new S.GameShopSearch(); case (ushort)ServerPacketIds.ItemProtectStart: return new S.ItemProtectStart(); case (ushort)ServerPacketIds.ExchangeConfigSearch: return new S.ExchangeConfigSearch(); case (ushort)ServerPacketIds.ItemAuctionSearch: return new S.ItemAuctionSearch(); case (ushort)ServerPacketIds.MyAuctionSearch: return new S.MyAuctionSearch(); case (ushort)ServerPacketIds.ConsignItem: return new S.ConsignItem(); case (ushort)ServerPacketIds.MarketFail: return new S.MarketFail(); case (ushort)ServerPacketIds.MarketSuccess: return new S.MarketSuccess(); case (ushort)ServerPacketIds.ObjectSitDown: return new S.ObjectSitDown(); case (ushort)ServerPacketIds.RefreshSeasonExitTime: return new S.RefreshSeasonExitTime(); case (ushort)ServerPacketIds.InTrapRock: return new S.InTrapRock(); case (ushort)ServerPacketIds.RemoveMagic: return new S.RemoveMagic(); case (ushort)ServerPacketIds.BaseStatsInfo: return new S.BaseStatsInfo(); case (ushort)ServerPacketIds.UserName: return new S.UserName(); case (ushort)ServerPacketIds.ChatItemStats: return new S.ChatItemStats(); case (ushort)ServerPacketIds.GuildMemberChange: return new S.GuildMemberChange(); case (ushort)ServerPacketIds.GuildNoticeChange: return new S.GuildNoticeChange(); case (ushort)ServerPacketIds.GuildStatus: return new S.GuildStatus(); case (ushort)ServerPacketIds.GetAllGuild: return new S.GetAllGuild(); case (ushort)ServerPacketIds.GetAllJoinRequest: return new S.GetAllJoinRequest(); case (ushort)ServerPacketIds.GuildInvite: return new S.GuildInvite(); case (ushort)ServerPacketIds.GuildExpGain: return new S.GuildExpGain(); case (ushort)ServerPacketIds.GuildNameRequest: return new S.GuildNameRequest(); case (ushort)ServerPacketIds.GuildStorageGoldChange: return new S.GuildStorageGoldChange(); case (ushort)ServerPacketIds.GuildStorageItemChange: return new S.GuildStorageItemChange(); case (ushort)ServerPacketIds.GuildStorageList: return new S.GuildStorageList(); case (ushort)ServerPacketIds.GuildRequestWar: return new S.GuildRequestWar(); case (ushort)ServerPacketIds.DefaultNPC: return new S.DefaultNPC(); case (ushort)ServerPacketIds.NPCUpdate: return new S.NPCUpdate(); case (ushort)ServerPacketIds.MarriageRequest: return new S.MarriageRequest(); case (ushort)ServerPacketIds.DivorceRequest: return new S.DivorceRequest(); case (ushort)ServerPacketIds.MentorRequest: return new S.MentorRequest(); case (ushort)ServerPacketIds.TradeRequest: return new S.TradeRequest(); case (ushort)ServerPacketIds.TradeAccept: return new S.TradeAccept(); case (ushort)ServerPacketIds.TradeGold: return new S.TradeGold(); case (ushort)ServerPacketIds.TradeItem: return new S.TradeItem(); case (ushort)ServerPacketIds.TradeCost: return new S.TradeCost(); case (ushort)ServerPacketIds.TradeConfirm: return new S.TradeConfirm(); case (ushort)ServerPacketIds.TradeCancel: return new S.TradeCancel(); case (ushort)ServerPacketIds.MountUpdate: return new S.MountUpdate(); case (ushort)ServerPacketIds.TransformUpdate: return new S.TransformUpdate(); case (ushort)ServerPacketIds.EquipSlotItem: return new S.EquipSlotItem(); case (ushort)ServerPacketIds.FishingUpdate: return new S.FishingUpdate(); case (ushort)ServerPacketIds.ChangeQuest: return new S.ChangeQuest(); case (ushort)ServerPacketIds.CompleteQuest: return new S.CompleteQuest(); case (ushort)ServerPacketIds.ShareQuest: return new S.ShareQuest(); case (ushort)ServerPacketIds.NewQuestInfo: return new S.NewQuestInfo(); case (ushort)ServerPacketIds.GainedQuestItem: return new S.GainedQuestItem(); case (ushort)ServerPacketIds.DeleteQuestItem: return new S.DeleteQuestItem(); case (ushort)ServerPacketIds.CancelReincarnation: return new S.CancelReincarnation(); case (ushort)ServerPacketIds.RequestReincarnation: return new S.RequestReincarnation(); case (ushort)ServerPacketIds.UserBackStep: return new S.UserBackStep(); case (ushort)ServerPacketIds.ObjectBackStep: return new S.ObjectBackStep(); case (ushort)ServerPacketIds.UserDashAttack: return new S.UserDashAttack(); case (ushort)ServerPacketIds.ObjectDashAttack: return new S.ObjectDashAttack(); case (ushort)ServerPacketIds.UserAttackMove://Warrior Skill - SlashingBurst return new S.UserAttackMove(); case (ushort)ServerPacketIds.CombineItem: return new S.CombineItem(); case (ushort)ServerPacketIds.ItemUpgraded: return new S.ItemUpgraded(); case (ushort)ServerPacketIds.SetConcentration: return new S.SetConcentration(); case (ushort)ServerPacketIds.SetObjectConcentration: return new S.SetObjectConcentration(); case (ushort)ServerPacketIds.SetElemental: return new S.SetElemental(); case (ushort)ServerPacketIds.SetObjectElemental: return new S.SetObjectElemental(); case (ushort)ServerPacketIds.RemoveDelayedExplosion: return new S.RemoveDelayedExplosion(); case (ushort)ServerPacketIds.ObjectDeco: return new S.ObjectDeco(); case (ushort)ServerPacketIds.ObjectSneaking: return new S.ObjectSneaking(); case (ushort)ServerPacketIds.ObjectLevelEffects: return new S.ObjectLevelEffects(); case (ushort)ServerPacketIds.SetBindingShot: return new S.SetBindingShot(); case (ushort)ServerPacketIds.SendOutputMessage: return new S.SendOutputMessage(); case (ushort)ServerPacketIds.NPCAwakening: return new S.NPCAwakening(); case (ushort)ServerPacketIds.NPCUnAwaken: return new S.NPCUnAwaken(); case (ushort)ServerPacketIds.NPCDisassemble: return new S.NPCDisassemble(); case (ushort)ServerPacketIds.NPCDowngrade: return new S.NPCDowngrade(); case (ushort)ServerPacketIds.NPCReset: return new S.NPCReset(); case (ushort)ServerPacketIds.AwakeningNeedMaterials: return new S.AwakeningNeedMaterials(); case (ushort)ServerPacketIds.DropProtectNeedMaterials: return new S.DropProtectNeedMaterials(); case (ushort)ServerPacketIds.AwakeningLockedItem: return new S.AwakeningLockedItem(); case (ushort)ServerPacketIds.Awakening: return new S.Awakening(); case (ushort)ServerPacketIds.UnAwakening: return new S.UnAwakening(); case (ushort)ServerPacketIds.ReceiveMail: return new S.ReceiveMail(); case (ushort)ServerPacketIds.MailLockedItem: return new S.MailLockedItem(); case (ushort)ServerPacketIds.MailSent: return new S.MailSent(); case (ushort)ServerPacketIds.MailSendRequest: return new S.MailSendRequest(); case (ushort)ServerPacketIds.ParcelCollected: return new S.ParcelCollected(); case (ushort)ServerPacketIds.MailCost: return new S.MailCost(); case (ushort)ServerPacketIds.ResizeInventory: return new S.ResizeInventory(); case (ushort)ServerPacketIds.NewIntelligentCreature: return new S.NewIntelligentCreature(); case (ushort)ServerPacketIds.UpdateIntelligentCreatureList: return new S.UpdateIntelligentCreatureList(); case (ushort)ServerPacketIds.IntelligentCreatureEnableRename: return new S.IntelligentCreatureEnableRename(); case (ushort)ServerPacketIds.IntelligentCreaturePickup: return new S.IntelligentCreaturePickup(); case (ushort)ServerPacketIds.NPCPearlGoods: return new S.NPCPearlGoods(); case (ushort)ServerPacketIds.FriendUpdate: return new S.FriendUpdate(); case (ushort)ServerPacketIds.FriendRequest: return new S.FriendRequest(); case (ushort)ServerPacketIds.LoverUpdate: return new S.LoverUpdate(); case (ushort)ServerPacketIds.MentorUpdate: return new S.MentorUpdate(); case (ushort)ServerPacketIds.GuildBuffList: return new S.GuildBuffList(); case (ushort)ServerPacketIds.GameShopInfo: return new S.GameShopInfo(); case (ushort)ServerPacketIds.GameShopStock: return new S.GameShopStock(); case (ushort)ServerPacketIds.NPCRequestInput: return new S.NPCRequestInput(); case (ushort)ServerPacketIds.Rankings: return new S.Rankings(); case (ushort)ServerPacketIds.Opendoor: return new S.Opendoor(); case (ushort)ServerPacketIds.OpenJyxt: return new S.OpenJyxt(); case (ushort)ServerPacketIds.InitialItem: return new S.InitialItem(); case (ushort)ServerPacketIds.MoveShield: return new S.MoveShield(); case (ushort)ServerPacketIds.ReshRecipes: return new S.ReshRecipes(); case (ushort)ServerPacketIds.AboutToQuest: return new S.AboutToQuest(); default: return null; } } } public class BaseStats { public float HpGain, HpGainRate, MpGainRate, BagWeightGain, WearWeightGain, HandWeightGain; public byte MinAc, MaxAc, MinMac, MaxMac, MinDc, MaxDc, MinMc, MaxMc, MinSc, MaxSc, StartAgility, StartAccuracy, StartCriticalRate, StartCriticalDamage, CritialRateGain, CriticalDamageGain; public short FireAC, WindAC, IceAC, LightAC, HolyAC, DarkAC, PhantomAC; public short FireMAC, WindMAC, IceMAC, LightMAC, HolyMAC, DarkMAC, PhantomMAC; public BaseStats(MirClass Job) { switch (Job) { case MirClass.Warrior: HpGain = 4F; HpGainRate = 4.5F; MpGainRate = 0; BagWeightGain = 3F; WearWeightGain = 20F; HandWeightGain = 13F; MinAc = 0; MaxAc = 7; MinMac = 0; MaxMac = 0; MinDc = 5; MaxDc = 5; MinMc = 0; MaxMc = 0; MinSc = 0; MaxSc = 0; FireAC = 0; WindAC = 0; IceAC = 0; LightAC = 0; HolyAC = 0; DarkAC = 0; PhantomAC = 0; FireMAC = 0; WindMAC = 0; IceMAC = 0; LightMAC = 0; HolyMAC = 0; DarkMAC = 0; PhantomMAC = 0; StartAgility = 15; StartAccuracy = 5; StartCriticalRate = 0; StartCriticalDamage = 0; CritialRateGain = 0; CriticalDamageGain = 0; break; case MirClass.Wizard: HpGain = 15F; HpGainRate = 1.8F; MpGainRate = 0; BagWeightGain = 5F; WearWeightGain = 100F; HandWeightGain = 90F; MinAc = 0; MaxAc = 0; MinMac = 0; MaxMac = 0; MinDc = 7; MaxDc = 7; MinMc = 7; MaxMc = 7; MinSc = 0; MaxSc = 0; FireAC = 0; WindAC = 0; IceAC = 0; LightAC = 0; HolyAC = 0; DarkAC = 0; PhantomAC = 0; FireMAC = 0; WindMAC = 0; IceMAC = 0; LightMAC = 0; HolyMAC = 0; DarkMAC = 0; PhantomMAC = 0; StartAgility = 15; StartAccuracy = 5; StartCriticalRate = 0; StartCriticalDamage = 0; CritialRateGain = 0; CriticalDamageGain = 0; break; case MirClass.Taoist: HpGain = 6F; HpGainRate = 2.5F; MpGainRate = 0; BagWeightGain = 4F; WearWeightGain = 50F; HandWeightGain = 42F; MinAc = 0; MaxAc = 0; MinMac = 12; MaxMac = 6; MinDc = 7; MaxDc = 7; MinMc = 0; MaxMc = 0; MinSc = 7; MaxSc = 7; FireAC = 0; WindAC = 0; IceAC = 0; LightAC = 0; HolyAC = 0; DarkAC = 0; PhantomAC = 0; FireMAC = 0; WindMAC = 0; IceMAC = 0; LightMAC = 0; HolyMAC = 0; DarkMAC = 0; PhantomMAC = 0; StartAgility = 18; StartAccuracy = 5; StartCriticalRate = 0; StartCriticalDamage = 0; CritialRateGain = 0; CriticalDamageGain = 0; break; case MirClass.Assassin: HpGain = 4F; HpGainRate = 3.25F; MpGainRate = 0; BagWeightGain = 3.5F; WearWeightGain = 33F; HandWeightGain = 30F; MinAc = 0; MaxAc = 0; MinMac = 0; MaxMac = 0; MinDc = 8; MaxDc = 8; MinMc = 0; MaxMc = 0; MinSc = 0; MaxSc = 0; FireAC = 0; WindAC = 0; IceAC = 0; LightAC = 0; HolyAC = 0; DarkAC = 0; PhantomAC = 0; FireMAC = 0; WindMAC = 0; IceMAC = 0; LightMAC = 0; HolyMAC = 0; DarkMAC = 0; PhantomMAC = 0; StartAgility = 20; StartAccuracy = 5; StartCriticalRate = 0; StartCriticalDamage = 0; CritialRateGain = 0; CriticalDamageGain = 0; break; case MirClass.Archer: HpGain = 4F; HpGainRate = 3.25F; MpGainRate = 0; BagWeightGain = 4F; //done WearWeightGain = 33F; HandWeightGain = 30F; MinAc = 0; MaxAc = 0; MinMac = 0; MaxMac = 0; MinDc = 8; MaxDc = 8; MinMc = 8; MaxMc = 8; MinSc = 0; MaxSc = 0; FireAC = 0; WindAC = 0; IceAC = 0; LightAC = 0; HolyAC = 0; DarkAC = 0; PhantomAC = 0; FireMAC = 0; WindMAC = 0; IceMAC = 0; LightMAC = 0; HolyMAC = 0; DarkMAC = 0; PhantomMAC = 0; StartAgility = 15; StartAccuracy = 8; StartCriticalRate = 0; StartCriticalDamage = 0; CritialRateGain = 0; CriticalDamageGain = 0; break; } } public BaseStats(BinaryReader reader) { HpGain = reader.ReadSingle(); HpGainRate = reader.ReadSingle(); MpGainRate = reader.ReadSingle(); MinAc = reader.ReadByte(); MaxAc = reader.ReadByte(); MinMac = reader.ReadByte(); MaxMac = reader.ReadByte(); MinDc = reader.ReadByte(); MaxDc = reader.ReadByte(); MinMc = reader.ReadByte(); MaxMc = reader.ReadByte(); MinSc = reader.ReadByte(); MaxSc = reader.ReadByte(); FireAC = reader.ReadInt16(); WindAC = reader.ReadInt16(); IceAC = reader.ReadInt16(); LightAC = reader.ReadInt16(); HolyAC = reader.ReadInt16(); DarkAC = reader.ReadInt16(); PhantomAC = reader.ReadInt16(); FireMAC = reader.ReadInt16(); WindMAC = reader.ReadInt16(); IceMAC = reader.ReadInt16(); LightMAC = reader.ReadInt16(); HolyMAC = reader.ReadInt16(); DarkMAC = reader.ReadInt16(); PhantomMAC = reader.ReadInt16(); StartAccuracy = reader.ReadByte(); StartAgility = reader.ReadByte(); StartCriticalRate = reader.ReadByte(); StartCriticalDamage = reader.ReadByte(); CritialRateGain = reader.ReadByte(); CriticalDamageGain = reader.ReadByte(); BagWeightGain = reader.ReadSingle(); WearWeightGain = reader.ReadSingle(); HandWeightGain = reader.ReadSingle(); } public void Save(BinaryWriter writer) { writer.Write(HpGain); writer.Write(HpGainRate); writer.Write(MpGainRate); writer.Write(MinAc); writer.Write(MaxAc); writer.Write(MinMac); writer.Write(MaxMac); writer.Write(MinDc); writer.Write(MaxDc); writer.Write(MinMc); writer.Write(MaxMc); writer.Write(MinSc); writer.Write(MaxSc); writer.Write(FireAC); writer.Write(WindAC); writer.Write(IceAC); writer.Write(LightAC); writer.Write(HolyAC); writer.Write(DarkAC); writer.Write(PhantomAC); writer.Write(FireMAC); writer.Write(WindMAC); writer.Write(IceMAC); writer.Write(LightMAC); writer.Write(HolyMAC); writer.Write(DarkMAC); writer.Write(PhantomMAC); writer.Write(StartAccuracy); writer.Write(StartAgility); writer.Write(StartCriticalRate); writer.Write(StartCriticalDamage); writer.Write(CritialRateGain); writer.Write(CriticalDamageGain); writer.Write(BagWeightGain); writer.Write(WearWeightGain); writer.Write(HandWeightGain); } } public class RandomItemStat { public byte MaxDuraChance, MaxDuraStatChance, MaxDuraMaxStat; public byte MaxAcChance, MaxAcStatChance, MaxAcMaxStat, MaxMacChance, MaxMacStatChance, MaxMacMaxStat, MaxDcChance, MaxDcStatChance, MaxDcMaxStat, MaxMcChance, MaxMcStatChance, MaxMcMaxStat, MaxScChance, MaxScStatChance, MaxScMaxStat; public byte AccuracyChance, AccuracyStatChance, AccuracyMaxStat, AgilityChance, AgilityStatChance, AgilityMaxStat, HpChance, HpStatChance, HpMaxStat, MpChance, MpStatChance, MpMaxStat, StrongChance, StrongStatChance, StrongMaxStat; public byte MagicResistChance, MagicResistStatChance, MagicResistMaxStat, PoisonResistChance, PoisonResistStatChance, PoisonResistMaxStat; public byte HpRecovChance, HpRecovStatChance, HpRecovMaxStat, MpRecovChance, MpRecovStatChance, MpRecovMaxStat, PoisonRecovChance, PoisonRecovStatChance, PoisonRecovMaxStat; public byte CriticalRateChance, CriticalRateStatChance, CriticalRateMaxStat, CriticalDamageChance, CriticalDamageStatChance, CriticalDamageMaxStat; public byte FreezeChance, FreezeStatChance, FreezeMaxStat, PoisonAttackChance, PoisonAttackStatChance, PoisonAttackMaxStat; public byte AttackSpeedChance, AttackSpeedStatChance, AttackSpeedMaxStat, LuckChance, LuckStatChance, LuckMaxStat; public byte AttackFireChance, AttackFireStatChance, AttackFireMaxStat; public byte AttackIceChance, AttackIceStatChance, AttackIceMaxStat; public byte AttackWindChance, AttackWindStatChance, AttackWindMaxStat; public byte AttackLightChance, AttackLightStatChance, AttackLightMaxStat; public byte AttackHolyChance, AttackHolyStatChance, AttackHolyMaxStat; public byte AttackDarkChance, AttackDarkStatChance, AttackDarkMaxStat; public byte AttackPhantomChance, AttackPhantomStatChance, AttackPhantomMaxStat; public byte EIAkNum, EiAcNum, EiAcStatChance, EiAcMaxStat; public byte BagWeightChance, BagWeightStatChance, BagWeightMaxStat; public byte WearWeightChance, WearWeightStatChance, WearWeightMaxStat; public byte HandWeightChance, HandWeightStatChance, HandWeightMaxStat; public byte CurseChance; public byte HideMaxAcChance, HideMaxAcStatChance, HideMaxAcMaxStat; public byte HideMaxMacChance, HideMaxMacStatChance, HideMaxMacMaxStat; public byte HideMaxDcChance, HideMaxDcStatChance, HideMaxDcMaxStat; public byte HideMaxMcChance, HideMaxMcStatChance, HideMaxMcMaxStat; public byte HideMaxScChance, HideMaxScStatChance, HideMaxScMaxStat; public byte HideAccuracyChance, HideAccuracyStatChance, HideAccuracyMaxStat; public byte HideAgilityChance, HideAgilityStatChance, HideAgilityMaxStat; public RandomItemStat(ItemType Type = ItemType.Book) { switch (Type) { case ItemType.Weapon: SetWeapon(); break; case ItemType.Armour: SetArmour(); break; case ItemType.Helmet: SetHelmet(); break; case ItemType.Belt: case ItemType.Boots: SetBeltBoots(); break; case ItemType.Necklace: SetNecklace(); break; case ItemType.Bracelet: SetBracelet(); break; case ItemType.Ring: SetRing(); break; case ItemType.Mount: SetMount(); break; } } public void SetWeapon() { MaxDuraChance = 2; MaxDuraStatChance = 13; MaxDuraMaxStat = 13; MaxDcChance = 15; MaxDcStatChance = 15; MaxDcMaxStat = 13; MaxMcChance = 20; MaxMcStatChance = 15; MaxMcMaxStat = 13; MaxScChance = 20; MaxScStatChance = 15; MaxScMaxStat = 13; AttackSpeedChance = 60; AttackSpeedStatChance = 30; AttackSpeedMaxStat = 3; StrongChance = 24; StrongStatChance = 20; StrongMaxStat = 2; AccuracyChance = 30; AccuracyStatChance = 20; AccuracyMaxStat = 2; } public void SetArmour() { MaxDuraChance = 2; MaxDuraStatChance = 10; MaxDuraMaxStat = 3; MaxAcChance = 30; MaxAcStatChance = 15; MaxAcMaxStat = 7; MaxMacChance = 30; MaxMacStatChance = 15; MaxMacMaxStat = 7; MaxDcChance = 40; MaxDcStatChance = 20; MaxDcMaxStat = 7; MaxMcChance = 40; MaxMcStatChance = 20; MaxMcMaxStat = 7; MaxScChance = 40; MaxScStatChance = 20; MaxScMaxStat = 7; } public void SetHelmet() { MaxDuraChance = 2; MaxDuraStatChance = 10; MaxDuraMaxStat = 3; MaxAcChance = 30; MaxAcStatChance = 15; MaxAcMaxStat = 7; MaxMacChance = 30; MaxMacStatChance = 15; MaxMacMaxStat = 7; MaxDcChance = 40; MaxDcStatChance = 20; MaxDcMaxStat = 7; MaxMcChance = 40; MaxMcStatChance = 20; MaxMcMaxStat = 7; MaxScChance = 40; MaxScStatChance = 20; MaxScMaxStat = 7; } public void SetBeltBoots() { MaxDuraChance = 2; MaxDuraStatChance = 10; MaxDuraMaxStat = 3; MaxAcChance = 30; MaxAcStatChance = 30; MaxAcMaxStat = 3; MaxMacChance = 30; MaxMacStatChance = 30; MaxMacMaxStat = 3; MaxDcChance = 30; MaxDcStatChance = 30; MaxDcMaxStat = 3; MaxMcChance = 30; MaxMcStatChance = 30; MaxMcMaxStat = 3; MaxScChance = 30; MaxScStatChance = 30; MaxScMaxStat = 3; AgilityChance = 60; AgilityStatChance = 30; AgilityMaxStat = 3; } public void SetNecklace() { MaxDuraChance = 2; MaxDuraStatChance = 10; MaxDuraMaxStat = 3; MaxDcChance = 15; MaxDcStatChance = 30; MaxDcMaxStat = 7; MaxMcChance = 15; MaxMcStatChance = 30; MaxMcMaxStat = 7; MaxScChance = 15; MaxScStatChance = 30; MaxScMaxStat = 7; AccuracyChance = 60; AccuracyStatChance = 30; AccuracyMaxStat = 7; AgilityChance = 60; AgilityStatChance = 30; AgilityMaxStat = 7; } public void SetBracelet() { MaxDuraChance = 2; MaxDuraStatChance = 10; MaxDuraMaxStat = 3; MaxAcChance = 20; MaxAcStatChance = 30; MaxAcMaxStat = 6; MaxMacChance = 20; MaxMacStatChance = 30; MaxMacMaxStat = 6; MaxDcChance = 30; MaxDcStatChance = 30; MaxDcMaxStat = 6; MaxMcChance = 30; MaxMcStatChance = 30; MaxMcMaxStat = 6; MaxScChance = 30; MaxScStatChance = 30; MaxScMaxStat = 6; } public void SetRing() { MaxDuraChance = 2; MaxDuraStatChance = 10; MaxDuraMaxStat = 3; MaxAcChance = 25; MaxAcStatChance = 20; MaxAcMaxStat = 6; MaxMacChance = 25; MaxMacStatChance = 20; MaxMacMaxStat = 6; MaxDcChance = 15; MaxDcStatChance = 30; MaxDcMaxStat = 6; MaxMcChance = 15; MaxMcStatChance = 30; MaxMcMaxStat = 6; MaxScChance = 15; MaxScStatChance = 30; MaxScMaxStat = 6; } public void SetMount() { SetRing(); } } public class ChatItem { public long RecievedTick = 0; public ulong ID = 0; public UserItem ItemStats; } public class UserId { public long Id = 0; public string UserName = ""; } #region ItemSets //public class ItemSets //{ // public ItemSet Set; // public List Type; // private byte Amount // { // get // { // switch (Set) // { // case ItemSet.Mundane: // case ItemSet.NokChi: // case ItemSet.TaoProtect: // case ItemSet.Whisker1: // case ItemSet.Whisker2: // case ItemSet.Whisker3: // case ItemSet.Whisker4: // case ItemSet.Whisker5: // return 2; // case ItemSet.RedOrchid: // case ItemSet.RedFlower: // case ItemSet.Smash: // case ItemSet.HwanDevil: // case ItemSet.Purity: // case ItemSet.FiveString: // case ItemSet.Bone: // case ItemSet.Bug: // case ItemSet.魔血: // return 3; // case ItemSet.Recall: // return 4; // case ItemSet.Spirit: // case ItemSet.WhiteGold: // case ItemSet.WhiteGoldH: // case ItemSet.RedJade: // case ItemSet.RedJadeH: // case ItemSet.Nephrite: // case ItemSet.NephriteH: // case ItemSet.Hyeolryong: // case ItemSet.Monitor: // case ItemSet.Oppressive: // case ItemSet.Paeok: // case ItemSet.Sulgwan: // //case ItemSet.金刚: // //case ItemSet.诺玛: // //case ItemSet.魔令: // case ItemSet.祈祷: // return 5; // default: // return 0; // } // } // } // public byte Count; // public bool SetComplete // { // get // { // return Count == Amount; // } // } //} public class ItemSetInfo { public int ID; public string Name; public List ItemList = new List(); public int AvaliableCount; public bool RepeatWearCal = false; public int MinAC, MaxAC, MinMAC, MaxMAC, MinDC, MaxDC, MinMC, MaxMC, MinSC, MaxSC, Accuracy, Agility; public int FireAC, WindAC, IceAC, LightAC, HolyAC, DarkAC, PhantomAC; public int FireMAC, WindMAC, IceMAC, LightMAC, HolyMAC, DarkMAC, PhantomMAC; public int HP, MP; public int AttackSpeed, Luck; public int MagicResist, PoisonResist, HealthRecovery, SpellRecovery, PoisonRecovery, HPrate, MPrate; public int CriticalRate, CriticalDamage; public int MaxAcRate, MaxMacRate, Holy, Freezing, PoisonAttack, HpDrainRate; public int Reflect, Parry, IgnoreAC, IgnoreMAC; public int ACRate, MacRate; public override string ToString() { return Name; } } public class ItemSets { public ItemSetInfo Set; public List ItemIndex; private byte Amount { get { return (byte)Set.AvaliableCount; } } public byte Count; public bool SetComplete { get { return Count >= Amount; } } } #endregion #region "Mine Related" public class MineSet { public string Name = string.Empty; public byte SpotRegenRate = 5; public byte MaxStones = 80; public byte HitRate = 25; public byte DropRate = 10; public byte TotalSlots = 100; public List Drops = new List(); private bool DropsSet = false; public MineSet(byte MineType = 0) { switch (MineType) { case 1: TotalSlots = 120; Drops.Add(new MineDrop() { ItemName = "GoldOre", MinSlot = 1, MaxSlot = 2, MinDura = 3, MaxDura = 16, BonusChance = 20, MaxBonusDura = 10 }); Drops.Add(new MineDrop() { ItemName = "SilverOre", MinSlot = 3, MaxSlot = 20, MinDura = 3, MaxDura = 16, BonusChance = 20, MaxBonusDura = 10 }); Drops.Add(new MineDrop() { ItemName = "CopperOre", MinSlot = 21, MaxSlot = 45, MinDura = 3, MaxDura = 16, BonusChance = 20, MaxBonusDura = 10 }); Drops.Add(new MineDrop() { ItemName = "BlackIronOre", MinSlot = 46, MaxSlot = 56, MinDura = 3, MaxDura = 16, BonusChance = 20, MaxBonusDura = 10 }); break; case 2: TotalSlots = 100; Drops.Add(new MineDrop() { ItemName = "PlatinumOre", MinSlot = 1, MaxSlot = 2, MinDura = 3, MaxDura = 16, BonusChance = 20, MaxBonusDura = 10 }); Drops.Add(new MineDrop() { ItemName = "RubyOre", MinSlot = 3, MaxSlot = 20, MinDura = 3, MaxDura = 16, BonusChance = 20, MaxBonusDura = 10 }); Drops.Add(new MineDrop() { ItemName = "NephriteOre", MinSlot = 21, MaxSlot = 45, MinDura = 3, MaxDura = 16, BonusChance = 20, MaxBonusDura = 10 }); Drops.Add(new MineDrop() { ItemName = "AmethystOre", MinSlot = 46, MaxSlot = 56, MinDura = 3, MaxDura = 16, BonusChance = 20, MaxBonusDura = 10 }); break; } } public void SetDrops(List items) { if (DropsSet) return; for (int i = 0; i < Drops.Count; i++) { for (int j = 0; j < items.Count; j++) { ItemInfo info = items[j]; if (String.Compare(info.Name.Replace(" ", ""), Drops[i].ItemName, StringComparison.OrdinalIgnoreCase) != 0) continue; Drops[i].Item = info; break; } } DropsSet = true; } } public class MineSpot { public byte StonesLeft = 0; public long LastRegenTick = 0; public MineSet Mine; } public class MineDrop { public string ItemName; public ItemInfo Item; public byte MinSlot = 0; public byte MaxSlot = 0; public byte MinDura = 1; public byte MaxDura = 1; public byte BonusChance = 0; public byte MaxBonusDura = 1; } public class MineZone { public int MapMineIndex; public byte Mine; public Point Location; public ushort Size; public MineZone() { } public MineZone(MySqlDataReader readerMineZoneInfo) { MapMineIndex = Convert.ToInt32(readerMineZoneInfo["MapMineIndex"]); Location = new Point(Convert.ToInt32(readerMineZoneInfo["Location_X"]), Convert.ToInt32(readerMineZoneInfo["Location_Y"])); Size = Convert.ToUInt16(readerMineZoneInfo["Size"]); Mine = Convert.ToByte(readerMineZoneInfo["Mine"]); } public MineZone(BinaryReader reader) { Location = new Point(reader.ReadInt32(), reader.ReadInt32()); Size = reader.ReadUInt16(); Mine = reader.ReadByte(); } public void Save(BinaryWriter writer) { writer.Write(Location.X); writer.Write(Location.Y); writer.Write(Size); writer.Write(Mine); } public override string ToString() { return string.Format("Mine: {0}- {1}", Functions.PointToString(Location), Mine); } } #endregion #region "Guild Related" public class ItemVolume { public ItemInfo Item; public string ItemName; public uint Amount; } public class Rank { public List Members = new List(); public string Name = ""; public int Index = 0; public RankOptions Options = (RankOptions)0; public Rank() { } public Rank(BinaryReader reader, bool Offline = false) { Name = reader.ReadString(); Options = (RankOptions)reader.ReadByte(); if (!Offline) Index = reader.ReadInt32(); int Membercount = reader.ReadInt32(); for (int j = 0; j < Membercount; j++) Members.Add(new GuildMember(reader, Offline)); } public void Save(BinaryWriter writer, bool Save = false) { writer.Write(Name); writer.Write((byte)Options); if (!Save) writer.Write(Index); writer.Write(Members.Count); for (int j = 0; j < Members.Count; j++) Members[j].save(writer); } } public class GuildStorageItem { public UserItem Item; public long UserId = 0; public GuildStorageItem() { } public GuildStorageItem(BinaryReader reader) { Item = new UserItem(reader); UserId = reader.ReadInt64(); } public void save(BinaryWriter writer) { Item.Save(writer); writer.Write(UserId); } } public class GuildMember { public string name = ""; public int Id; [JsonIgnore] public object Player; public DateTime LastLogin; public bool hasvoted; public bool Online; public string LatestLocateMap=""; public int DonatePoint; public GuildMember() { } public GuildMember(BinaryReader reader, bool Offline = false) { name = reader.ReadString(); Id = reader.ReadInt32(); LastLogin = DateTime.FromBinary(reader.ReadInt64()); hasvoted = reader.ReadBoolean(); Online = reader.ReadBoolean(); Online = Offline ? false : Online; LatestLocateMap=reader.ReadString(); if (string.IsNullOrEmpty(LatestLocateMap)) { LatestLocateMap = ""; } DonatePoint=reader.ReadInt32(); } public void save(BinaryWriter writer) { writer.Write(name); writer.Write(Id); writer.Write(LastLogin.ToBinary()); writer.Write(hasvoted); writer.Write(Online); writer.Write(LatestLocateMap); writer.Write(DonatePoint); } } [Flags] [Obfuscation(Feature = "renaming", Exclude = true)] public enum RankOptions : byte { CanChangeRank = 1, CanRecruit = 2, CanKick = 4, CanStoreItem = 8, CanRetrieveItem = 16, CanAlterAlliance = 32, CanChangeNotice = 64, CanActivateBuff = 128 } public class GuildBuffInfo { public int Id; public int Icon = 0; public string name = ""; public byte LevelRequirement; public byte PointsRequirement = 1; public int TimeLimit; public int ActivationCost; public byte BuffAc; public byte BuffMac; public byte BuffDc; public byte BuffMc; public byte BuffSc; public byte BuffAttack; public int BuffMaxHp; public int BuffMaxMp; public byte BuffMineRate; public byte BuffGemRate; public byte BuffFishRate; public byte BuffExpRate; public byte BuffCraftRate; public byte BuffSkillRate; public byte BuffHpRegen; public byte BuffMPRegen; public byte BuffDropRate; public byte BuffGoldRate; public GuildBuffInfo() { } public GuildBuffInfo(BinaryReader reader) { Id = reader.ReadInt32(); Icon = reader.ReadInt32(); name = reader.ReadString(); LevelRequirement = reader.ReadByte(); PointsRequirement = reader.ReadByte(); TimeLimit = reader.ReadInt32(); ActivationCost = reader.ReadInt32(); BuffAc = reader.ReadByte(); BuffMac = reader.ReadByte(); BuffDc = reader.ReadByte(); BuffMc = reader.ReadByte(); BuffSc = reader.ReadByte(); BuffMaxHp = reader.ReadInt32(); BuffMaxMp = reader.ReadInt32(); BuffMineRate = reader.ReadByte(); BuffGemRate = reader.ReadByte(); BuffFishRate = reader.ReadByte(); BuffExpRate = reader.ReadByte(); BuffCraftRate = reader.ReadByte(); BuffSkillRate = reader.ReadByte(); BuffHpRegen = reader.ReadByte(); BuffMPRegen = reader.ReadByte(); BuffAttack = reader.ReadByte(); BuffDropRate = reader.ReadByte(); BuffGoldRate = reader.ReadByte(); } public GuildBuffInfo(InIReader reader, int i) { Id = reader.ReadInt32("Buff-" + i.ToString(), "Id", 0); Icon = reader.ReadInt32("Buff-" + i.ToString(), "Icon", 0); name = reader.ReadString("Buff-" + i.ToString(), "Name", ""); LevelRequirement = reader.ReadByte("Buff-" + i.ToString(), "LevelReq", 0); PointsRequirement = reader.ReadByte("Buff-" + i.ToString(), "PointsReq", 1); TimeLimit = reader.ReadInt32("Buff-" + i.ToString(), "TimeLimit", 0); ; ActivationCost = reader.ReadInt32("Buff-" + i.ToString(), "ActivationCost", 0); BuffAc = reader.ReadByte("Buff-" + i.ToString(), "BuffAc", 0); BuffMac = reader.ReadByte("Buff-" + i.ToString(), "BuffMAC", 0); BuffDc = reader.ReadByte("Buff-" + i.ToString(), "BuffDc", 0); BuffMc = reader.ReadByte("Buff-" + i.ToString(), "BuffMc", 0); BuffSc = reader.ReadByte("Buff-" + i.ToString(), "BuffSc", 0); BuffMaxHp = reader.ReadInt32("Buff-" + i.ToString(), "BuffMaxHp", 0); BuffMaxMp = reader.ReadInt32("Buff-" + i.ToString(), "BuffMaxMp", 0); BuffMineRate = reader.ReadByte("Buff-" + i.ToString(), "BuffMineRate", 0); BuffGemRate = reader.ReadByte("Buff-" + i.ToString(), "BuffGemRate", 0); BuffFishRate = reader.ReadByte("Buff-" + i.ToString(), "BuffFishRate", 0); BuffExpRate = reader.ReadByte("Buff-" + i.ToString(), "BuffExpRate", 0); BuffCraftRate = reader.ReadByte("Buff-" + i.ToString(), "BuffCraftRate", 0); BuffSkillRate = reader.ReadByte("Buff-" + i.ToString(), "BuffSkillRate", 0); BuffHpRegen = reader.ReadByte("Buff-" + i.ToString(), "BuffHpRegen", 0); BuffMPRegen = reader.ReadByte("Buff-" + i.ToString(), "BuffMpRegen", 0); BuffAttack = reader.ReadByte("Buff-" + i.ToString(), "BuffAttack", 0); BuffDropRate = reader.ReadByte("Buff-" + i.ToString(), "BuffDropRate", 0); BuffGoldRate = reader.ReadByte("Buff-" + i.ToString(), "BuffGoldRate", 0); } public void Save(InIReader reader, int i) { reader.Write("Buff-" + i.ToString(), "Id", Id); reader.Write("Buff-" + i.ToString(), "Icon", Icon); reader.Write("Buff-" + i.ToString(), "Name", name); reader.Write("Buff-" + i.ToString(), "LevelReq", LevelRequirement); reader.Write("Buff-" + i.ToString(), "PointsReq", PointsRequirement); reader.Write("Buff-" + i.ToString(), "TimeLimit", TimeLimit); ; reader.Write("Buff-" + i.ToString(), "ActivationCost", ActivationCost); ; reader.Write("Buff-" + i.ToString(), "BuffAc", BuffAc); ; reader.Write("Buff-" + i.ToString(), "BuffMAC", BuffMac); ; reader.Write("Buff-" + i.ToString(), "BuffDc", BuffDc); ; reader.Write("Buff-" + i.ToString(), "BuffMc", BuffMc); ; reader.Write("Buff-" + i.ToString(), "BuffSc", BuffSc); ; reader.Write("Buff-" + i.ToString(), "BuffMaxHp", BuffMaxHp); ; reader.Write("Buff-" + i.ToString(), "BuffMaxMp", BuffMaxMp); ; reader.Write("Buff-" + i.ToString(), "BuffMineRate", BuffMineRate); ; reader.Write("Buff-" + i.ToString(), "BuffGemRate", BuffGemRate); ; reader.Write("Buff-" + i.ToString(), "BuffFishRate", BuffFishRate); ; reader.Write("Buff-" + i.ToString(), "BuffExpRate", BuffExpRate); ; reader.Write("Buff-" + i.ToString(), "BuffCraftRate", BuffCraftRate); ; reader.Write("Buff-" + i.ToString(), "BuffSkillRate", BuffSkillRate); ; reader.Write("Buff-" + i.ToString(), "BuffHpRegen", BuffHpRegen); ; reader.Write("Buff-" + i.ToString(), "BuffMpRegen", BuffMPRegen); ; reader.Write("Buff-" + i.ToString(), "BuffAttack", BuffAttack); ; reader.Write("Buff-" + i.ToString(), "BuffDropRate", BuffDropRate); ; reader.Write("Buff-" + i.ToString(), "BuffGoldRate", BuffGoldRate); ; } public void Save(BinaryWriter writer) { writer.Write(Id); writer.Write(Icon); writer.Write(name); writer.Write(LevelRequirement); writer.Write(PointsRequirement); writer.Write(TimeLimit); writer.Write(ActivationCost); writer.Write(BuffAc); writer.Write(BuffMac); writer.Write(BuffDc); writer.Write(BuffMc); writer.Write(BuffSc); writer.Write(BuffMaxHp); writer.Write(BuffMaxMp); writer.Write(BuffMineRate); writer.Write(BuffGemRate); writer.Write(BuffFishRate); writer.Write(BuffExpRate); writer.Write(BuffCraftRate); writer.Write(BuffSkillRate); writer.Write(BuffHpRegen); writer.Write(BuffMPRegen); writer.Write(BuffAttack); writer.Write(BuffDropRate); writer.Write(BuffGoldRate); } public override string ToString() { return string.Format("{0}: {1}", Id, name); } public string ShowStats() { string text = string.Empty; //text = name + "\n"; if (BuffAc > 0) { text += string.Format("防御力+ 0-{0}.", BuffAc); if (text != "") text += "\n"; } if (BuffMac > 0) { text += string.Format("魔法防御+ 0-{0}.", BuffMac); if (text != "") text += "\n"; } if (BuffDc > 0) { text += string.Format("攻击+ 0-{0}.", BuffDc); if (text != "") text += "\n"; } if (BuffMc > 0) { text += string.Format("自然系魔法+ 0-{0}.", BuffMc); if (text != "") text += "\n"; } if (BuffSc > 0) { text += string.Format("灵魂系魔法+ 0-{0}.", BuffSc); if (text != "") text += "\n"; } if (BuffMaxHp > 0) { text += string.Format("HP + {0}.", BuffMaxHp); if (text != "") text += "\n"; } if (BuffMaxMp > 0) { text += string.Format("MP + {0}.", BuffMaxMp); if (text != "") text += "\n"; } if (BuffHpRegen > 0) { text += string.Format("HP恢复+ {0}.", BuffHpRegen); if (text != "") text += "\n"; } if (BuffMPRegen > 0) { text += string.Format("MP恢复+ {0}.", BuffMPRegen); if (text != "") text += "\n"; } if (BuffMineRate > 0) { text += string.Format("采矿出矿率+ {0}%.", BuffMineRate * 5); if (text != "") text += "\n"; } if (BuffGemRate > 0) { text += string.Format("宝玉成功率+ {0}%.", BuffGemRate * 5); if (text != "") text += "\n"; } if (BuffFishRate > 0) { text += string.Format("钓鱼成功率+ {0}%.", BuffFishRate * 5); if (text != "") text += "\n"; } if (BuffExpRate > 0) { text += string.Format("获取经验+ {0}%.", BuffExpRate); if (text != "") text += "\n"; } if (BuffCraftRate > 0) { text += string.Format("制作成功率+ {0}%.", BuffCraftRate * 5); if (text != "") text += "\n"; } if (BuffSkillRate > 0) { text += string.Format("技能熟练度+ {0}.", BuffSkillRate); if (text != "") text += "\n"; } if (BuffAttack > 0) { text += string.Format("伤害+ {0}.", BuffAttack); if (text != "") text += "\n"; } if (BuffDropRate > 0) { text += string.Format("掉宝率+ {0}%.", BuffDropRate); if (text != "") text += "\n"; } if (BuffGoldRate > 0) { text += string.Format("庄园税金+ {0}%.", BuffGoldRate); if (text != "") text += "\n"; } return text; } } public class GuildMemberRequest { public int Index; public DateTime RequestTime; public string Remark; } public class GuildBuff { public int Id; public GuildBuffInfo Info; public bool Active = false; public int ActiveTimeRemaining; public bool UsingGuildSkillIcon { get { return Info != null && Info.Icon < 1000; } } public GuildBuff() { } public GuildBuff(BinaryReader reader) { Id = reader.ReadInt32(); Active = reader.ReadBoolean(); ActiveTimeRemaining = reader.ReadInt32(); } public void Save(BinaryWriter writer) { writer.Write(Id); writer.Write(Active); writer.Write(ActiveTimeRemaining); } public string PrintTimeSpan(double secs) { TimeSpan t = TimeSpan.FromMinutes(secs); string answer; if (t.TotalMinutes < 1.0) { answer = string.Format("{0}s", t.Seconds); } else if (t.TotalHours < 1.0) { answer = string.Format("{0}ms", t.Minutes); } else // more than 1 hour { answer = string.Format("{0}h {1:D2}m ", (int)t.TotalHours, t.Minutes); } return answer; } public string ShowStats() { if (Info == null) return ""; return Info.ShowStats(); } } //outdated but cant delete it or old db's wont load public class GuildBuffOld { public GuildBuffOld() { } public GuildBuffOld(BinaryReader reader) { reader.ReadByte(); reader.ReadInt64(); } } #endregion #region Ranking Pete107|Petesn00beh 15/1/2016 public class Rank_Character_Info { public long PlayerId; public string Name; public MirClass Class; public int level; //排行榜; public long Experience;//clients shouldnt care about this only server public object info;//again only keep this on server! public Rank_Character_Info() { } public Rank_Character_Info(BinaryReader reader) { //rank = reader.ReadInt32(); PlayerId = reader.ReadInt64(); Name = reader.ReadString(); level = reader.ReadInt32(); Class = (MirClass)reader.ReadByte(); } public void Save(BinaryWriter writer) { //writer.Write(rank); writer.Write(PlayerId); writer.Write(Name); writer.Write(level); writer.Write((byte)Class); } } #endregion public class Door { public byte index; public byte DoorState;//0: 关闭, 1: 打开中, 2: 打开, 3: 关闭中 public byte ImageIndex; public long LastTick; public Point Location; } public class Accountdata { public virtual int IndexID { get; set; } public virtual string AccountID { get; set; } public virtual string Password { get; set; } public virtual int AccountResize { get; set; } public virtual int Gold { get; set; } public virtual int Credit { get; set; } public virtual short AdminAccount { get; set; } public virtual int HookSuspicionLevel { get; set; } public Accountdata() { } public Accountdata(BinaryReader reader) { IndexID = reader.ReadInt32(); AccountID = reader.ReadString(); Password = reader.ReadString(); AccountResize = reader.ReadInt32(); Gold = reader.ReadInt32(); Credit = reader.ReadInt32(); AdminAccount = reader.ReadInt16(); HookSuspicionLevel = reader.ReadInt32(); } public void Save(BinaryWriter writer) { writer.Write(IndexID); writer.Write(AccountID); writer.Write(Password); writer.Write(AccountResize); writer.Write(Gold); writer.Write(Credit); writer.Write(AdminAccount); writer.Write(HookSuspicionLevel); } }