diff --git a/src/Common/Common.csproj b/src/Common/Common.csproj index b1fd9db..9e168a4 100644 --- a/src/Common/Common.csproj +++ b/src/Common/Common.csproj @@ -52,6 +52,7 @@ + diff --git a/src/Common/Constants.cs b/src/Common/Constants.cs index a75e026..8bb2bef 100644 --- a/src/Common/Constants.cs +++ b/src/Common/Constants.cs @@ -2,11 +2,6 @@ namespace Destiny { - public static class ExperienceTables - { - public static readonly int[] CharacterLevel = { 1, 15, 34, 57, 92, 135, 372, 560, 840, 1242, 1242, 1242, 1242, 1242, 1242, 1490, 1788, 2146, 2575, 3090, 3708, 4450, 5340, 6408, 7690, 9228, 11074, 13289, 15947, 19136, 19136, 19136, 19136, 19136, 19136, 22963, 27556, 33067, 39681, 47616, 51425, 55539, 59582, 64781, 69963, 75560, 81605, 88133, 95184, 102799, 111023, 119905, 129497, 139857, 151046, 163129, 176180, 190274, 205496, 221936, 239691, 258866, 279575, 301941, 326097, 352184, 380359, 410788, 443651, 479143, 479143, 479143, 479143, 479143, 479143, 512683, 548571, 586971, 628059, 672024, 719065, 769400, 823258, 880886, 942548, 1008526, 1079123, 1154662, 1235488, 1321972, 1414511, 1513526, 1619473, 1732836, 1854135, 1983924, 2122799, 2271395, 2430393, 2600520, 2782557, 2977336, 3185749, 3408752, 3647365, 3902680, 4175868, 4468179, 4780951, 5115618, 5473711, 5856871, 6266852, 6705531, 7176919, 7677163, 8214565, 8789584, 9404855, 10063195, 10063195, 10063195, 10063195, 10063195, 10063195, 10767619, 11521352, 12327847, 13190796, 14114152, 15102142, 16159292, 17290443, 18500774, 19795828, 21181536, 22664244, 24250741, 25948292, 27764673, 29708200, 31787774, 34012918, 36393823, 38941390, 41667310, 44584022, 47704904, 51044247, 54617344, 58440558, 62531397, 66908595, 71592197, 76603651, 81965907, 87703520, 93842766, 100411760, 107440583, 113887018, 120720239, 127963453, 135641260, 143779736, 152406520, 161550911, 171243966, 181518604, 192409720, 203954303, 216191561, 229163055, 242912838, 257487608, 272936864, 289313076, 306671861, 325072173, 344576503, 365251093, 387166159, 410396129, 435019897, 461121091, 488788356, 518115657, 549202596, 582154752, 617084037, 654109079, 693355624, 734956961, 779054379, 825797642, 875345501, 927866231, 983538205, 1042550497, 1105103527, int.MaxValue }; //NOTE: Last value is needed or else level 200 characters will throw an IndexOutOfRange exception - } - public static class ServerRegistrationResponseResolver { public static string Explain(ServerRegsitrationResponse Packet) @@ -36,236 +31,6 @@ public enum ServerRegsitrationResponse : byte Full } - #region Character - public enum Gender : byte - { - Male, - Female, - Both, - Unset = 10 - } - - public enum Job : short - { - Beginner, - - Warrior = 100, - Fighter = 110, - Crusader, - Hero, - Page = 120, - WhiteKnight, - Paladin, - Spearman = 130, - DragonKnight, - DarkKnight, - - Magician = 200, - FirePoisonWizard = 210, - FirePoisonMage, - FirePoisonArchMage, - IceLightningWizard = 220, - IceLightningMage, - IceLightningArchMage, - Cleric = 230, - Priest, - Bishop, - - Bowman = 300, - Hunter = 310, - Ranger, - BowMaster, - CrossbowMan = 320, - Sniper, - CrossbowMaster, - - Thief = 400, - Assassin = 410, - Hermit, - NightLord, - Bandit = 420, - ChiefBandit, - Shadower, - - Pirate = 500, - Brawler = 510, - Marauder, - Buccaneer, - Gunslinger = 520, - Outlaw, - Corsair, - - MapleleafBrigadier = 800, - GM = 900, - SuperGM = 910, - - Noblesse = 1000, - - DawnWarrior1 = 1100, - DawnWarrior2 = 1110, - DawnWarrior3, - DawnWarrior4, - - BlazeWizard1 = 1200, - BlazeWizard2 = 1210, - BlazeWizard3, - BlazeWizard4, - - WindArcher1 = 1300, - WindArcher2 = 1310, - WindArcher3, - WindArcher4, - - NightWalker1 = 1400, - NightWalker2 = 1410, - NightWalker3, - NightWalker4, - - ThunderBreaker1 = 1500, - ThunderBreaker2 = 1510, - ThunderBreaker3, - ThunderBreaker4, - - Legend = 2000, - - Aran1 = 2100, - Aran2 = 2110, - Aran3, - Aran4 - } - - public enum JobType - { - Cygnus = 0, - Explorer = 1, - Aran = 2 - } - - public enum UserEffect : byte - { - LevelUp = 0, - SkillUse = 1, - SkillAffected = 2, - Quest = 3, - Pet = 4, - SkillSpecial = 5, - ProtectOnDieItemUse = 6, - PlayPortalSE = 7, - JobChanged = 8, - QuestComplete = 9, - IncDecHPEffect = 10, - BuffItemEffect = 11, - SquibEffect = 12, - MonsterBookCardGet = 13, - LotteryUse = 14, - ItemLevelUp = 15, - ItemMaker = 16, - ExpItemConsumed = 17, - ReservedEffect = 18, - Buff = 19, - ConsumeEffect = 20, - UpgradeTombItemUse = 21, - BattlefieldItemUse = 22, - AvatarOriented = 23, - IncubatorUse = 24, - PlaySoundWithMuteBGM = 25, - SoulStoneUse = 26, - IncDecHPEffect_EX = 27, - DeliveryQuestItemUse = 28, // NOTE: Post big bang update. - RepeatEffectRemove = 29, // NOTE: Post big bang update. - EvolRing = 30 // NOTE: Post big bang update. - } - - [Flags] - public enum StatisticType : int - { - None = 0x0, - - Skin = 0x1, - Face = 0x2, - Hair = 0x4, - Level = 0x10, - Job = 0x20, - Strength = 0x40, - Dexterity = 0x80, - Intelligence = 0x100, - Luck = 0x200, - Health = 0x400, - MaxHealth = 0x800, - Mana = 0x1000, - MaxMana = 0x2000, - AbilityPoints = 0x4000, - SkillPoints = 0x8000, - Experience = 0x10000, - Fame = 0x20000, - Mesos = 0x40000, - Pet = 0x180000, - GachaponExperience = 0x200000 - } - - public enum AttackType - { - Melee, - Range, - Magic, - Summon - } - - public enum CommandType : byte - { - Find = 5, - Whisper = 6 - } - - public enum AdminCommandType : byte - { - CreateItem = 0, - DestroyFirstITem = 1, - GiveExperience = 2, - Ban = 3, - Block = 4, - VarSetGet = 9, - Hide = 16, - ShowMessageMap = 17, - Send = 18, - Summon = 23, - Snow = 28, - Warn = 29, - Log = 30, - SetObjectState = 34 - } - - public enum CharacterDisease : ulong - { - None, - Slow = 0x1, - Seduce = 0x80, - Fishable = 0x100, - Confuse = 0x80000, - Stun = 0x2000000000000, - Poison = 0x4000000000000, - Sealed = 0x8000000000000, - Darkness = 0x10000000000000, - Weaken = 0x4000000000000000, - Curse = 0x8000000000000000 - } - - public enum ReportType : byte - { - IllegalProgramUsage = 0, - ConversationClaim = 1 - } - - public enum ReportResult : byte - { - Success, - UnableToLocate, - Max10TimesADay, - YouAreReportedByUser, - UnknownError - } - #endregion - #region Equipment public enum EquipmentSlot : sbyte { @@ -280,9 +45,16 @@ public enum EquipmentSlot : sbyte Cape = -9, Shield = -10, Weapon = -11, - Ring = -12, + Ring1 = -12, + Ring2 = -13, + // -14 ?? + Ring3 = -15, + Ring4 = -16, Necklace = -17, Mount = -18, + Saddle = -19, + Medal = -49, + Belt = -50, CashHat = -101, CashFace = -102, CashEye = -103, @@ -692,12 +464,12 @@ public enum MobStatus : int MagicImmunity = 0x80000, Unknown2 = 0x100000, - Unknown3 = 0x200000, + HardSkin = 0x200000, NinjaAmbush = 0x400000, - Unknown4 = 0x800000, + ElementalAttribute = 0x800000, VenomousWeapon = 0x1000000, - Unknown5 = 0x2000000, - Unknown6 = 0x4000000, + Blind = 0x2000000, + SealSkill = 0x4000000, Empty = 0x8000000, Hypnotized = 0x10000000, WeaponDamageReflect = 0x20000000, @@ -911,609 +683,6 @@ public enum NoticeType : byte } #endregion - #region Skills and Buffs - public static class SkillNames - { - public enum All : int - { - RegularAttack = 0 - } - - public enum Beginner : int - { - BlessingOfTheFairy = 12, - EchoOfHero = 1005, - FollowTheLead = 8, - MonsterRider = 1004, - NimbleFeet = 1002, - Recovery = 1001 - } - - public enum Swordsman : int - { - ImprovedMaxHpIncrease = 1000001, - IronBody = 1001003 - } - - public enum Fighter : int - { - AxeBooster = 1101005, - AxeMastery = 1100001, - PowerGuard = 1101007, - Rage = 1101006, - SwordBooster = 1101004, - SwordMastery = 1100000 - } - - public enum Crusader : int - { - ArmorCrash = 1111007, - AxeComa = 1111006, - AxePanic = 1111004, - ComboAttack = 1111002, - Shout = 1111008, - SwordComa = 1111005, - SwordPanic = 1111003 - } - - public enum Hero : int - { - Achilles = 1120004, - AdvancedComboAttack = 1120003, - Enrage = 1121010, - Guardian = 1120005, - HerosWill = 1121011, - MapleWarrior = 1121000, - MonsterMagnet = 1121001, - PowerStance = 1121002 - } - - public enum Page : int - { - BwBooster = 1201005, - BwMastery = 1200001, - PowerGuard = 1201007, - SwordBooster = 1201004, - SwordMastery = 1200000, - Threaten = 1201006 - } - - public enum WhiteKnight : int - { - BwFireCharge = 1211004, - BwIceCharge = 1211006, - BwLitCharge = 1211008, - ChargeBlow = 1211002, - MagicCrash = 1211009, - SwordFireCharge = 1211003, - SwordIceCharge = 1211005, - SwordLitCharge = 1211007 - } - - public enum Paladin : int - { - Achilles = 1220005, - AdvancedCharge = 1220010, - BwHolyCharge = 1221004, - Guardian = 1220006, - HeavensHammer = 1221011, - HerosWill = 1221012, - MapleWarrior = 1221000, - MonsterMagnet = 1221001, - PowerStance = 1221002, - SwordHolyCharge = 1221003 - } - - public enum Spearman : int - { - HyperBody = 1301007, - IronWill = 1301006, - PolearmBooster = 1301005, - PolearmMastery = 1300001, - SpearBooster = 1301004, - SpearMastery = 1300000 - } - - public enum DragonKnight : int - { - DragonBlood = 1311008, - DragonRoar = 1311006, - ElementalResistance = 1310000, - PowerCrash = 1311007, - Sacrifice = 1311005 - } - - public enum DarkKnight : int - { - Achilles = 1320005, - AuraOfBeholder = 1320008, - Beholder = 1321007, - Berserk = 1320006, - HerosWill = 1321010, - HexOfBeholder = 1320009, - MapleWarrior = 1321000, - MonsterMagnet = 1321001, - PowerStance = 1321002 - } - - public enum Magician : int - { - ImprovedMaxMpIncrease = 2000001, - MagicArmor = 2001003, - MagicGuard = 2001002 - } - - public enum FirePoisonWizard : int - { - Meditation = 2101001, - MpEater = 2100000, - PoisonBreath = 2101005, - Slow = 2101003 - } - - public enum FirePoisonMage : int - { - ElementAmplification = 2110001, - ElementComposition = 2111006, - PartialResistance = 2110000, - PoisonMist = 2111003, - Seal = 2111004, - SpellBooster = 2111005 - } - - public enum FirePoisonArchMage : int - { - BigBang = 2121001, - Elquines = 2121005, - FireDemon = 2121003, - HerosWill = 2121008, - Infinity = 2121004, - ManaReflection = 2121002, - MapleWarrior = 2121000, - Paralyze = 2121006 - } - - public enum IceLightningWizard : int - { - ColdBeam = 2201004, - Meditation = 2201001, - MpEater = 2200000, - Slow = 2201003 - } - - public enum IceLightningMage : int - { - ElementAmplification = 2210001, - ElementComposition = 2211006, - IceStrike = 2211002, - PartialResistance = 2210000, - Seal = 2211004, - SpellBooster = 2211005 - } - - public enum IceLightningArchMage : int - { - BigBang = 2221001, - Blizzard = 2221007, - HerosWill = 2221008, - IceDemon = 2221003, - Ifrit = 2221005, - Infinity = 2221004, - ManaReflection = 2221002, - MapleWarrior = 2221000 - } - - public enum Cleric : int - { - Bless = 2301004, - Heal = 2301002, - Invincible = 2301003, - MpEater = 2300000 - } - - public enum Priest : int - { - Dispel = 2311001, - Doom = 2311005, - ElementalResistance = 2310000, - HolySymbol = 2311003, - MysticDoor = 2311002, - SummonDragon = 2311006 - } - - public enum Bishop : int - { - Bahamut = 2321003, - BigBang = 2321001, - HerosWill = 2321009, - HolyShield = 2321005, - Infinity = 2321004, - ManaReflection = 2321002, - MapleWarrior = 2321000, - Resurrection = 2321006 - } - - public enum Archer : int - { - CriticalShot = 3000001, - Focus = 3001003 - } - - public enum Hunter : int - { - ArrowBomb = 3101005, - BowBooster = 3101002, - BowMastery = 3100000, - SoulArrow = 3101004 - } - - public enum Ranger : int - { - MortalBlow = 3110001, - Puppet = 3111002, - SilverHawk = 3111005 - } - - public enum Bowmaster : int - { - Concentrate = 3121008, - Hamstring = 3121007, - HerosWill = 3121009, - Hurricane = 3121004, - MapleWarrior = 3121000, - Phoenix = 3121006, - SharpEyes = 3121002 - } - - public enum Crossbowman : int - { - CrossbowBooster = 3201002, - CrossbowMastery = 3200000, - SoulArrow = 3201004 - } - - public enum Sniper : int - { - Blizzard = 3211003, - GoldenEagle = 3211005, - MortalBlow = 3210001, - Puppet = 3211002 - } - - public enum Marksman : int - { - Blind = 3221006, - Frostprey = 3221005, - HerosWill = 3221008, - MapleWarrior = 3221000, - PiercingArrow = 3221001, - SharpEyes = 3221002, - Snipe = 3221007 - } - - public enum Rogue : int - { - DarkSight = 4001003, - Disorder = 4001002, - DoubleStab = 4001334, - LuckySeven = 4001344 - } - - public enum Assassin : int - { - - ClawBooster = 4101003, - ClawMastery = 4100000, - CriticalThrow = 4100001, - Drain = 4101005, - Haste = 4101004 - } - - public enum Hermit : int - { - Alchemist = 4110000, - Avenger = 4111005, - MesoUp = 4111001, - ShadowMeso = 4111004, - ShadowPartner = 4111002, - ShadowWeb = 4111003 - } - - public enum NightLord : int - { - HerosWill = 4121009, - MapleWarrior = 4121000, - NinjaAmbush = 4121004, - NinjaStorm = 4121008, - ShadowShifter = 4120002, - ShadowStars = 4121006, - Taunt = 4121003, - TripleThrow = 4121007, - VenomousStar = 4120005 - } - - public enum Bandit : int - { - DaggerBooster = 4201002, - DaggerMastery = 4200000, - Haste = 4201003, - SavageBlow = 4201005, - Steal = 4201004 - } - - public enum ChiefBandit : int - { - Assaulter = 4211002, - BandOfThieves = 4211004, - Chakra = 4211001, - MesoExplosion = 4211006, - MesoGuard = 4211005, - Pickpocket = 4211003 - } - - public enum Shadower : int - { - Assassinate = 4221001, - BoomerangStep = 4221007, - HerosWill = 4221008, - MapleWarrior = 4221000, - NinjaAmbush = 4221004, - ShadowShifter = 4220002, - Smokescreen = 4221006, - Taunt = 4221003, - VenomousStab = 4220005 - } - - public enum Pirate : int - { - Dash = 5001005 - } - - public enum Brawler : int - { - BackspinBlow = 5101002, - CorkscrewBlow = 5101004, - DoubleUppercut = 5101003, - ImproveMaxHp = 5100000, - KnucklerBooster = 5101006, - KnucklerMastery = 5100001, - MpRecovery = 5101005, - OakBarrel = 5101007 - } - - public enum Marauder : int - { - EnergyCharge = 5110001, - EnergyDrain = 5111004, - StunMastery = 5110000, - Transformation = 5111005 - } - - public enum Buccaneer : int - { - Demolition = 5121004, - MapleWarrior = 5121000, - PiratesRage = 5121008, - Snatch = 5121005, - SpeedInfusion = 5121009, - SuperTransformation = 5121003, - TimeLeap = 5121010 - } - - public enum Gunslinger : int - { - BlankShot = 5201004, - Grenade = 5201002, - GunBooster = 5201003, - GunMastery = 5200000 - } - - public enum Outlaw : int - { - Flamethrower = 5211004, - Gaviota = 5211002, - HomingBeacon = 5211006, - IceSplitter = 5211005, - Octopus = 5211001 - } - - public enum Corsair : int - { - AerialStrike = 5221003, - Battleship = 5221006, - Bullseye = 5220011, - ElementalBoost = 5220001, - Hypnotize = 5221009, - MapleWarrior = 5221000, - RapidFire = 5221004, - SpeedInfusion = 5221010, - WrathOfTheOctopi = 5220002 - } - - public enum GM : int - { - Haste = 9001000, - SuperDragonRoar = 9001001, - Teleport = 9001007 - } - - public enum SuperGM : int - { - HealPlusDispel = 9101000, - Haste = 9101001, - HolySymbol = 9101002, - Bless = 9101003, - Hide = 9101004, - Resurrection = 9101005, - SuperDragonRoar = 9101006, - Teleport = 9101007, - HyperBody = 9101008, - } - - public enum Noblesse : int - { - BlessingOfTheFairy = 10000012, - EchoOfHero = 10001005, - Maker = 10001007, - MonsterRider = 10001004, - NimbleFeet = 10001002, - Recovery = 10001001 - } - - public enum DawnWarrior : int - { - AdvancedCombo = 11110005, - Coma = 11111003, - ComboAttack = 11111001, - FinalAttack = 11101002, - IronBody = 11001001, - MaxHpEnhancement = 11000000, - Panic = 11111002, - Rage = 11101003, - Soul = 11001004, - SoulBlade = 11101004, - SoulCharge = 11111007, - SwordBooster = 11101001, - SwordMastery = 11100000 - } - - public enum BlazeWizard : int - { - ElementalReset = 12101005, - ElementAmplification = 12110001, - FireStrike = 12111006, - Flame = 12001004, - FlameGear = 12111005, - Ifrit = 12111004, - IncreasingMaxMp = 12000000, - MagicArmor = 12001002, - MagicGuard = 12001001, - Meditation = 12101000, - Seal = 12111002, - Slow = 12101001, - SpellBooster = 12101004 - } - - public enum WindArcher : int - { - EagleEye = 13111005, - BowBooster = 13101001, - BowMastery = 13100000, - CriticalShot = 13000000, - FinalAttack = 13101002, - Focus = 13001002, - Hurricane = 13111002, - Puppet = 13111004, - SoulArrow = 13101003, - Storm = 13001004, - WindPiercing = 13111006, - WindShot = 13111007, - WindWalk = 13101006 - } - - public enum NightWalker : int - { - Alchemist = 14110003, - Disorder = 14001002, - DarkSight = 14001003, - Darkness = 14001005, - ClawBooster = 14101002, - ClawMastery = 14100000, - CriticalThrow = 14100001, - Haste = 14101003, - PoisonBomb = 14111006, - ShadowPartner = 14111000, - ShadowWeb = 14111001, - SuddenAttack = 14100005, - Vampire = 14101006, - Venom = 14110004 - } - - public enum ThunderBreaker : int - { - CorkscrewBlow = 15101003, - Dash = 15001003, - EnergyCharge = 15100004, - EnergyDrain = 15111001, - ImproveMaxHp = 15100000, - KnucklerBooster = 15101002, - KnucklerMastery = 15100001, - Lightning = 15001004, - LightningCharge = 15101006, - Spark = 15111006, - SpeedInfusion = 15111005, - Transformation = 15111002 - } - } - - public enum SecondaryBuffStat : long - { - HomingBeacon = (0x1), - Morph = (0x2), - Recovery = (0x4), - MapleWarrrior = (0x8), - Stance = (0x10), - SharpEyes = (0x20), - ManaReflection = (0x40), - ShadowClaw = (0x100), - Infinity = (0x200), - HolyShield = (0x400), - Hamstring = (0x800), - Blind = (0x1000), - Concentrate = (0x2000), - EchoOfHero = (0x8000), - GhostMorph = (0x20000), - Aura = (0x40000), - Confuse = (0x80000), - BerserkFury = (0x8000000), - DivineBody = (0x10000000), - FinalAttack = (0x80000000), - WeaponAttack = (0x100000000L), - WeaponDefense = (0x200000000L), - MagicAttack = (0x400000000L), - MagicDefense = (0x800000000L), - Accuracy = (0x1000000000L), - Avoid = (0x2000000000L), - Hands = (0x4000000000L), - Speed = (0x8000000000L), - Jump = (0x10000000000L), - MagicGuard = (0x20000000000L), - DarkSight = (0x40000000000L), - Booster = (0x80000000000L), - PowerGuard = (0x100000000000L), - HyperBodyHP = (0x200000000000L), - HyperBodyMP = (0x400000000000L), - Invincible = (0x800000000000L), - SoulArrow = (0x1000000000000L), - Stun = (0x2000000000000L), - Poison = (0x4000000000000L), - Seal = (0x8000000000000L), - Darkness = (0x10000000000000L), - Combo = (0x20000000000000L), - Summon = (0x20000000000000L), - WKCharge = (0x40000000000000L), - DragonBlood = (0x80000000000000L), - HolySymbol = (0x100000000000000L), - MesoUp = (0x200000000000000L), - ShadowPartner = (0x400000000000000L), - PickPocket = (0x800000000000000L), - Puppet = (0x800000000000000L), - MesoGuard = (0x1000000000000000L), - Weaken = (0x4000000000000000L), - } - - public enum PrimaryBuffStat : long - { - EnergyCharged = 0, - DashSpeed = 1, - DashJump = 2, - RideVehicle = 3, - PartyBooster = 4, - GuidedBullet = 5, - Undead = 6 - } - #endregion - #region Social public enum MessengerAction : byte { diff --git a/src/Common/Constants/CharacterConstants.cs b/src/Common/Constants/CharacterConstants.cs new file mode 100644 index 0000000..01359f1 --- /dev/null +++ b/src/Common/Constants/CharacterConstants.cs @@ -0,0 +1,1140 @@ +using System; + +namespace Destiny.Constants +{ + public class CharacterConstants + { + public static class ExperienceTables + { + public static readonly int[] BegginerLevels = { 1, 15, 34, 57, 92, 135, 372, 560, 840, 1242, 1144 }; + public static readonly int[] FirstJobLevels = { 1573, 2144, 2800, 3640, 4700, 5893, 7360, 9144, 11120, 13477, 16268, 19320, 22880, 27008, 31477, 36600, 42444, 48720, 55813, 63800 }; + public static readonly int[] SecondJobLevels = { 86784, 98208, 110932, 124432, 139372, 155865, 173280, 192400, 213345, 235372, 259392, 285532, 312928, 342624, 374760, 408336, 445544, 483532, 524160, 567772, 598886, 631704, 666321, 702836, 741351, 781976, 824828, 870028, 917625, 967995, 1021041, 1076994, 1136013, 1198266, 1263930, 1333194, 1406252, 1483314, 1564600, 1650340 }; + public static readonly int[] ThirdJobLevels = { 1740778, 1836173, 1936794, 2042930, 2154882, 2272970, 2397528, 2528912, 2667496, 2813674, 2967863, 3130502, 3302053, 3483005, 3673873, 3875201, 4087562, 4311559, 4547832, 4797053, 5059931, 5337215, 5629694, 5938202, 6263614, 6606860, 6968915, 7350811, 7753635, 8178534, 8626718, 9099462, 9598112, 10124088, 10678888, 11264090, 11881362, 12532461, 13219239, 13943653, 14707765, 15513750, 16363902, 17260644, 18206527, 19204245, 20256637, 21366700, 22537594, 23772654 }; + public static readonly int[] FourthJobLevels = { 25075395, 26449526, 27898960, 29427822, 31040466, 32741483, 34535716, 36428273, 38424542, 40530206, 42751262, 45094030, 47565183, 50171755, 52921167, 55821246, 58880250, 62106888, 65510344, 69100311, 72887008, 76881216, 81094306, 85594273, 90225770, 95170142, 100385466, 105886589, 111689174, 117809740, 124265714, 131075474, 138258410, 145834970, 153826726, 162256430, 171148082, 180526997, 190419876, 200854885, 211861732, 223471711, 223471711, 248635353, 262260570, 276632449, 291791906, 307782102, 324648562, 342439302, 361204976, 380999008, 401877754, 423900654, 447130410, 471633156, 497478653, 524740482, 553496261, 583827855, 615821622, 649568646, 685165008, 722712050, 762316670, 804091623, 848155844, 894634784, 943660770, 995373379, 1049919840, 1107455447, 1168144006, 1232158297, 1299680571, 1370903066, 1446028554, 1525246918, 1608855764, 1697021059 }; + + public static readonly int[] PetLevels = { 1, 1, 3, 6, 14, 31, 60, 108, 181, 287, 434, 632, 891, 1224, 1642, 2161, 2793, 3557, 4467, 5542, 6801, 8263, 9950, 11882, 14084, 16578, 19391, 22547, 26074, 30000, int.MaxValue }; + public static readonly int[] PetCloseness = { 0, 1, 3, 6, 14, 31, 60, 108, 181, 287, 434, 632, 891, 1224, 1642, 2161, 2793, 3557, 4467, 5542, 9000 }; + public static readonly int[] MountLevels = { 1, 24, 50, 105, 134, 196, 254, 263, 315, 367, 430, 543, 587, 679, 725, 897, 1146, 1394, 1701, 2247, 2543, 2898, 3156, 3313, 3584, 3923, 4150, 4305, 4550 }; + + //TODO: these data seem slightly wrong? + public static readonly int[] CharacterLevel = { 1, 15, 34, 57, 92, 135, 372, 560, 840, 1242, 1242, 1242, 1242, 1242, 1242, 1490, 1788, 2146, 2575, 3090, 3708, 4450, 5340, 6408, 7690, 9228, 11074, 13289, 15947, 19136, 19136, 19136, 19136, 19136, 19136, 22963, 27556, 33067, 39681, 47616, 51425, 55539, 59582, 64781, 69963, 75560, 81605, 88133, 95184, 102799, 111023, 119905, 129497, 139857, 151046, 163129, 176180, 190274, 205496, 221936, 239691, 258866, 279575, 301941, 326097, 352184, 380359, 410788, 443651, 479143, 479143, 479143, 479143, 479143, 479143, 512683, 548571, 586971, 628059, 672024, 719065, 769400, 823258, 880886, 942548, 1008526, 1079123, 1154662, 1235488, 1321972, 1414511, 1513526, 1619473, 1732836, 1854135, 1983924, 2122799, 2271395, 2430393, 2600520, 2782557, 2977336, 3185749, 3408752, 3647365, 3902680, 4175868, 4468179, 4780951, 5115618, 5473711, 5856871, 6266852, 6705531, 7176919, 7677163, 8214565, 8789584, 9404855, 10063195, 10063195, 10063195, 10063195, 10063195, 10063195, 10767619, 11521352, 12327847, 13190796, 14114152, 15102142, 16159292, 17290443, 18500774, 19795828, 21181536, 22664244, 24250741, 25948292, 27764673, 29708200, 31787774, 34012918, 36393823, 38941390, 41667310, 44584022, 47704904, 51044247, 54617344, 58440558, 62531397, 66908595, 71592197, 76603651, 81965907, 87703520, 93842766, 100411760, 107440583, 113887018, 120720239, 127963453, 135641260, 143779736, 152406520, 161550911, 171243966, 181518604, 192409720, 203954303, 216191561, 229163055, 242912838, 257487608, 272936864, 289313076, 306671861, 325072173, 344576503, 365251093, 387166159, 410396129, 435019897, 461121091, 488788356, 518115657, 549202596, 582154752, 617084037, 654109079, 693355624, 734956961, 779054379, 825797642, 875345501, 927866231, 983538205, 1042550497, 1105103527, int.MaxValue }; //NOTE: Last value is needed or else level 200 characters will throw an IndexOutOfRange exception + } + + #region Character + public enum Gender : byte + { + Male, + Female, + Both, + Unset = 10 + } + + public enum Job : short + { + Beginner, + + Warrior = 100, + Fighter = 110, + Crusader, + Hero, + Page = 120, + WhiteKnight, + Paladin, + Spearman = 130, + DragonKnight, + DarkKnight, + + Magician = 200, + FirePoisonWizard = 210, + FirePoisonMage, + FirePoisonArchMage, + IceLightningWizard = 220, + IceLightningMage, + IceLightningArchMage, + Cleric = 230, + Priest, + Bishop, + + Bowman = 300, + Hunter = 310, + Ranger, + BowMaster, + CrossbowMan = 320, + Sniper, + CrossbowMaster, + + Thief = 400, + Assassin = 410, + Hermit, + NightLord, + Bandit = 420, + ChiefBandit, + Shadower, + + Pirate = 500, + Brawler = 510, + Marauder, + Buccaneer, + Gunslinger = 520, + Outlaw, + Corsair, + + MapleleafBrigadier = 800, + GM = 900, + SuperGM = 910, + + Noblesse = 1000, + + DawnWarrior1 = 1100, + DawnWarrior2 = 1110, + DawnWarrior3, + DawnWarrior4, + + BlazeWizard1 = 1200, + BlazeWizard2 = 1210, + BlazeWizard3, + BlazeWizard4, + + WindArcher1 = 1300, + WindArcher2 = 1310, + WindArcher3, + WindArcher4, + + NightWalker1 = 1400, + NightWalker2 = 1410, + NightWalker3, + NightWalker4, + + ThunderBreaker1 = 1500, + ThunderBreaker2 = 1510, + ThunderBreaker3, + ThunderBreaker4, + + Legend = 2000, //evan unimplemented? + + Aran1 = 2100, + Aran2 = 2110, + Aran3, + Aran4 + } + + public enum JobType + { + Cygnus = 0, + Explorer = 1, + Aran = 2 + } + + public enum UserEffect : byte + { + LevelUp = 0, + SkillUse = 1, + SkillAffected = 2, + Quest = 3, + Pet = 4, + SkillSpecial = 5, + ProtectOnDieItemUse = 6, + PlayPortalSE = 7, + JobChanged = 8, + QuestComplete = 9, + IncDecHPEffect = 10, + BuffItemEffect = 11, + SquibEffect = 12, + MonsterBookCardGet = 13, + LotteryUse = 14, + ItemLevelUp = 15, + ItemMaker = 16, + ExpItemConsumed = 17, + ReservedEffect = 18, + Buff = 19, + ConsumeEffect = 20, + UpgradeTombItemUse = 21, + BattlefieldItemUse = 22, + AvatarOriented = 23, + IncubatorUse = 24, + PlaySoundWithMuteBGM = 25, + SoulStoneUse = 26, + IncDecHPEffect_EX = 27, + DeliveryQuestItemUse = 28, // NOTE: Post big bang update. + RepeatEffectRemove = 29, // NOTE: Post big bang update. + EvolRing = 30 // NOTE: Post big bang update. + } + + [Flags] + public enum StatisticType : int + { + None = 0x0, + + Skin = 0x1, + Face = 0x2, + Hair = 0x4, + Level = 0x10, + Job = 0x20, + Strength = 0x40, + Dexterity = 0x80, + Intelligence = 0x100, + Luck = 0x200, + Health = 0x400, + MaxHealth = 0x800, + Mana = 0x1000, + MaxMana = 0x2000, + AbilityPoints = 0x4000, + SkillPoints = 0x8000, + Experience = 0x10000, + Fame = 0x20000, + Mesos = 0x40000, + Pet = 0x180000, + GachaponExperience = 0x200000 + } + + public enum AttackType + { + Melee, + Range, + Magic, + Summon + } + + public enum AttackElementType + { + Neutral, + Fire, + Poison, + Ice, + Lighting, + Holy, + } + + public enum CommandType : byte + { + Find = 5, + Whisper = 6 + } + + public enum AdminCommandType : byte + { + CreateItem = 0, + DestroyFirstITem = 1, + GiveExperience = 2, + Ban = 3, + Block = 4, + VarSetGet = 9, + Hide = 16, + ShowMessageMap = 17, + Send = 18, + Summon = 23, + Snow = 28, + Warn = 29, + Log = 30, + SetObjectState = 34 + } + + public enum CharacterDisease : ulong + { + None = 0x0L, + + Slow = 0x1L, + Seduce = 0x80L, + Fishable = 0x100L, + Confuse = 0x80000L, + Stun = 0x2000000000000L, + Poison = 0x4000000000000L, + Sealed = 0x8000000000000L, + Darkness = 0x10000000000000L, + Weaken = 0x4000000000000000L, + Curse = 0x8000000000000000L + } + + public enum ReportType : byte + { + IllegalProgramUsage = 0, + ConversationClaim = 1 + } + + public enum ReportResult : byte + { + Success, + UnableToLocate, + Max10TimesADay, + YouAreReportedByUser, + UnknownError + } + #endregion + + #region Skills and Buffs + + public static class SkillNames + { + public enum All : int + { + RegularAttack = 0 + } + + public enum Beginner : int + { + FollowTheLead = 8, + BlessingOfTheFairy = 12, + ChairMaster = 100, + ThreeSnails = 1000, + Recovery = 1001, + NimbleFeet = 1002, + LegendarySpirit = 1003, + MonsterRider = 1004, + EchoOfHero = 1005, + JumpDown = 1006, + Maker = 1007, + //dojoo temporary skills + BambooRain = 1009, + Invincibility = 1010, + PowerExplosion = 1011 + //TODO: other temporary skills + } + + public enum Swordsman : int + { + ImprovedHPRecovery = 1000000, + ImprovedMaxHpIncrease = 1000001, + Endure = 1000002, + IronBody = 1001003, + PowerStrike = 1001004, + SlashBlast = 1001005, + } + + public enum Fighter : int + { + SwordMastery = 1100000, + AxeMastery = 1100001, + FinalAttackSword = 1100002, + FinalAttackAxe = 1100003, + SwordBooster = 1101004, + AxeBooster = 1101005, + Rage = 1101006, + PowerGuard = 1101007 + } + + public enum Crusader : int + { + ShieldMastery = 1111001, + ComboAttack = 1111002, + PanicSword = 1111003, + PanicAxe = 1111004, + ComaSword = 1111005, + ComaAxe = 1111006, + ArmorCrash = 1111007, + Shout = 1111008 + } + + public enum Hero : int + { + AdvancedComboAttack = 1120003, + Achilles = 1120004, + Guardian = 1120005, + MapleWarrior = 1121000, + MonsterMagnet = 1121001, + PowerStance = 1121002, + Rush = 1121006, + Brandish = 1121008, + Enrage = 1121010, + HerosWill = 1121011, + } + + public enum Page : int + { + SwordMastery = 1200000, + BWMastery = 1200001, + FinalAttackSword = 1200002, + FinalAttackBW = 1200003, + SwordBooster = 1201004, + BWBooster = 1201005, + Threaten = 1201006, + PowerGuard = 1201007 + } + + public enum WhiteKnight : int + { + ImprovingMPRecovery = 1210000, + ShieldMastery = 1210001, + ChargedBlow = 1211002, + FireChargeSword = 1211003, + FlameChargeBW = 1211004, + IceChargeSword = 1211005, + BlizzardChargeBW = 1211006, + ThunderChargeSword = 1211007, + LightningChargeBW = 1211008, + MagicCrash = 1211009 + } + + public enum Paladin : int + { + Achilles = 1220005, + Guardian = 1220006, + AdvancedCharge = 1220010, + MapleWarrior = 1221000, + MonsterMagnet = 1221001, + PowerStance = 1221002, + HolyChargeSword = 1221003, + DivineChargeBW = 1221004, + Rush = 1221007, + Blast = 1221009, + HeavensHammer = 1221011, + HerosWill = 1221012 + } + + public enum Spearman : int + { + SpearMastery = 1300000, + PoleArmMastery = 1300001, + FinalAttackSpear = 1300002, + FinalAttackPoleArm = 1300003, + SpearBooster = 1301004, + PoleArmBooster = 1301005, + IronWill = 1301006, + HyperBody = 1301007 + } + + public enum DragonKnight : int + { + ElementalResistance = 1310000, + SpearCrusher = 1310001, + PoleArmCrusher = 1310002, + DragonFurySpear = 1311003, + DragonFuryPoleArm = 1311004, + Sacrifice = 1311005, + DragonRoar = 1311006, + PowerCrash = 1311007, + DragonBlood = 1311008 + } + + public enum DarkKnight : int + { + Achilles = 1320005, + Berserk = 1320006, + AuraOfBeholder = 1320008, + HexOfBeholder = 1320009, + MapleWarrior = 1321000, + MonsterMagnet = 1321001, + PowerStance = 1321002, + Rush = 1321003, + Beholder = 1321007, + HerosWill = 1321010 + } + + public enum Magician : int + { + ImprovedMPRecovery = 2000000, + ImprovedMaxMpIncrease = 2000001, + MagicGuard = 2001002, + MagicArmor = 2001003, + EnergyBolt = 2001004, + MagicClaw = 2001005 + } + + public enum FirePoisonWizard : int + { + MpEater = 2100000, + Meditation = 2101001, + Teleportation = 2101002, + Slow = 2101003, + FireArrow = 2101004, + PoisonBreath = 2101005 + } + + public enum FirePoisonMage : int + { + PartialResistance = 2110000, + ElementAmplification = 2110001, + Explosion = 2110002, + PoisonMist = 2111003, + Seal = 2111004, + SpellBooster = 2111005, + ElementComposition = 2111006 + } + + public enum FirePoisonArchMage : int + { + MapleWarrior = 2121000, + BigBang = 2121001, + ManaReflection = 2121002, + FireDemon = 2121003, + Infinity = 2121004, + Elquines = 2121005, + Paralyze = 2121006, + MeteorShower = 2121007, + HerosWill = 2121008 + } + + public enum IceLightningWizard : int + { + MpEater = 2200000, + Meditation = 2201001, + Teleport = 2201002, + Slow = 2201003, + ColdBeam = 2201004, + ThunderBolt = 2201005 + } + + public enum IceLightningMage : int + { + PartialResistance = 2210000, + ElementAmplification = 2210001, + IceStrike = 2211002, + ThunderSpear = 2211003, + Seal = 2211004, + SpellBooster = 2211005, + ElementComposition = 2211006 + } + + public enum IceLightningArchMage : int + { + MapleWarrior = 2221000, + BigBang = 2221001, + ManaReflection = 2221002, + IceDemon = 2221003, + Infinity = 2221004, + Ifrit = 2221005, + ChainLightning = 2221006, + Blizzard = 2221007, + HerosWill = 2221008 + } + + public enum Cleric : int + { + MpEater = 2300000, + Teleport = 2300001, + Heal = 2301002, + Invincible = 2301003, + Bless = 2301004, + HolyArrow = 2301005 + } + + public enum Priest : int + { + ElementalResistance = 2310000, + Dispel = 2311001, + MysticDoor = 2311002, + HolySymbol = 2311003, + ShiningRay = 2311004, + Doom = 2311005, + SummonDragon = 2311006 + } + + public enum Bishop : int + { + MapleWarrior = 2321000, + BigBang = 2321001, + ManaReflection = 2321002, + Bahamut = 2321003, + Infinity = 2321004, + HolyShield = 2321005, + Resurrection = 2321006, + AngelRay = 2321007, + Genesis = 2321008, + HerosWill = 2321009 + } + + public enum Archer : int + { + TheBlessingofAmazon = 3000000, + CriticalShot = 3000001, + TheEyeofAmazon = 3000002, + Focus = 3001003, + ArrowBlow = 3001004, + DoubleShot = 3001005 + } + + public enum Hunter : int + { + BowMastery = 3100000, + FinalAttackBow = 3100001, + BowBooster = 3101002, + PowerKnock = 3101003, + SoulArrowBow = 3101004, + ArrowBombBow = 3101005 + } + + public enum Ranger : int + { + Thrust = 3110000, + MortalBlow = 3110001, + Puppet = 3111002, + Inferno = 3111003, + ArrowRain = 3111004, + SilverHawk = 3111005, + Strafe = 3111006 + } + + public enum Bowmaster : int + { + BowExpert = 3120005, + MapleWarrior = 3121000, + SharpEyes = 3121002, + DragonsBreath = 3121003, + Hurricane = 3121004, + Phoenix = 3121006, + Hamstring = 3121007, + Concentrate = 3121008, + HerosWill = 3121009 + } + + public enum Crossbowman : int + { + CrossbowMastery = 3200000, + FinalAttackCrossbow = 3200001, + CrossbowBooster = 3201002, + PowerKnock = 3201002, + SoulArrowCrossbow = 3201004, + IronArrowCrossbow = 3201005 + } + + public enum Sniper : int + { + Thurst = 3210000, + MortalBlow = 3210001, + Puppet = 3211002, + Blizzard = 3211003, + ArrowEruption = 3211004, + GoldenEagle = 3211005, + Strafe = 3211006 + } + + public enum Marksman : int + { + MarksmanBoost = 3220004, + MapleWarrior = 3221000, + PiercingArrow = 3221001, + SharpEyes = 3221002, + DragonsBreath = 3221003, + Frostprey = 3221005, + Blind = 3221006, + Snipe = 3221007, + HerosWill = 3221008 + } + + public enum Rogue : int + { + NimbleBody = 4000000, + KeenEyes = 4000001, + Disorder = 4001002, + DarkSight = 4001003, + DoubleStab = 4001334, + LuckySeven = 4001344 + } + + public enum Assassin : int + { + ClawMastery = 4100000, + CriticalThrow = 4100001, + Endure = 4100002, + ClawBooster = 4101003, + Haste = 4101004, + Drain = 4101005 + } + + public enum Hermit : int + { + Alchemist = 4110000, + MesoUp = 4111001, + ShadowPartner = 4111002, + ShadowWeb = 4111003, + ShadowMeso = 4111004, + Avenger = 4111005, + FlashJump = 4111006 + } + + public enum NightLord : int + { + ShadowShifter = 4120002, + VenomousStar = 4120005, + MapleWarrior = 4121000, + Taunt = 4121003, + NinjaAmbush = 4121004, + ShadowStars = 4121006, + TripleThrow = 4121007, + NinjaStorm = 4121008, + HerosWill = 4121009 + } + + public enum Bandit : int + { + DaggerMastery = 4200000, + Endure = 4201001, + DaggerBooster = 4201002, + Haste = 4201003, + Steal = 4201004, + SavageBlow = 4201005 + } + + public enum ChiefBandit : int + { + ShieldMastery = 4211000, + Chakra = 4211001, + Assaulter = 4211002, + Pickpocket = 4211003, + BandOfThieves = 4211004, + MesoGuard = 4211005, + MesoExplosion = 4211006 + } + + public enum Shadower : int + { + ShadowShifter = 4220002, + VenomousStab = 4220005, + MapleWarrior = 4221000, + Assassinate = 4221001, + Taunt = 4221003, + NinjaAmbush = 4221004, + Smokescreen = 4221006, + BoomerangStep = 4221007, + HerosWill = 4221008 + } + + public enum Pirate : int + { + BulletTime = 5000000, + FlashFist = 5001001, + SommersaultKick = 5001002, + DoubleShot = 5001003, + Dash = 5001005 + } + + public enum Brawler : int + { + ImproveMaxHp = 5100000, + KnucklerMastery = 5100001, + BackspinBlow = 5101002, + DoubleUppercut = 5101003, + CorkscrewBlow = 5101004, + MPRecovery = 5101005, + KnucklerBooster = 5101006, + OakBarrel = 5101007 + } + + public enum Marauder : int + { + StunMastery = 5110000, + EnergyCharge = 5110001, + EnergyBlast = 5110002, + EnergyDrain = 5111004, + Transformation = 5111005, + Shockwave = 5111006 + } + + public enum Buccaneer : int + { + MapleWarrior = 5121000, + DragonStrike = 5121001, + EnergyOrb = 5121002, + SuperTransformation = 5121003, + Demolition = 5121004, + Snatch = 5121005, + Barrage = 5121007, + PiratesRage = 5121008, + SpeedInfusion = 5121009, + TimeLeap = 5121010 + } + + public enum Gunslinger : int + { + GunMastery = 5200000, + InvisibleShot = 5201001, + Grenade = 5201002, + GunBooster = 5201003, + BlankShot = 5201004, + Wings = 5201005, + RecoilShot = 5201006 + } + + public enum Outlaw : int + { + BurstFire = 5210000, + Octopus = 5211001, + Gaviota = 5211002, + Flamethrower = 5211004, + IceSplitter = 5211005, + HomingBeacon = 5211006 + } + + public enum Corsair : int + { + ElementalBoost = 5220001, + WrathoftheOctopi = 5220002, + Bullseye = 5220011, + MapleWarrior = 5221000, + AerialStrike = 5221003, + RapidFire = 5221004, + Battleship = 5221006, + BattleshipCannon = 5221007, + BattleshipTorpedo = 5221008, + Hypnotize = 5221009, + SpeedInfusion = 5221010 + } + + public enum MapleLeafBrigadier : int + { + //?????? = 8001000, + // ???? = 8001001 + } + + public enum GM : int + { + Haste = 9001000, //official name is Haste(Normal) + SuperDragonRoar = 9001001, + Teleport = 9001002, + Bless = 9001003, + Hide = 9001004, + Resurrection = 9001005, + SuperDragonRoar2 = 9001006, //?? + Teleport2 = 9001007, //?? + HyperBody = 9001008, + ADMIN_ANTIMACRO = 9001009 //?? + } + + public enum SuperGM : int + { + HealPlusDispel = 9101000, //official name is Heal+Dispel + Haste = 9101001, //official name is Haste(Super) + HolySymbol = 9101002, + Bless = 9101003, + Hide = 9101004, + Resurrection = 9101005, + SuperDragonRoar = 9101006, + Teleport = 9101007, + HyperBody = 9101008 + } + + public enum Noblesse : int + { + BlessingOfTheFairy = 10000012, + Helper = 10000013, + FollowtheLead = 10000018, + ChairMastery = 10000100, + ThreeSnails = 10001000, + Recovery = 10001001, + NimbleFeet = 10001002, + LegendarySpirit = 10001003, + MonsterRider = 10001004, + EchoOfHero = 10001005, + JumpDown = 10001006, //hidden? + Maker = 10001007, + + //dojoo temporary skills + BambooThrust = 10001009, + InvincibleBarrier = 10001010, + MeteoShower = 10001011, + //TODO: other temporary skills + } + + public enum DawnWarrior : int // 1st job + { + MaxHPEnhancement = 11000000, + IronBody = 11001001, + PowerStrike = 11001002, + SlashBlast = 11001003, + Soul = 11001004, + } + + public enum DawnWarrior2 : int // 2nd job + { + SwordMastery = 11100000, + SwordBooster = 11101001, + FinalAttack = 11101002, + Rage = 11101003, + SoulBlade = 11101004, + SoulRush = 11101005, + } + + public enum DawnWarrior3 : int // 3rd job + { + MPRecoveryRateEnhancement = 11110000, + Advancedcombo = 11110005, + ComboAttack = 11111001, + Panic = 11111002, + Coma = 11111003, + Brandish = 11111004, + SoulDriver = 11111006, + SoulCharge = 11111007 + } + + public enum DawnWarrior4 : int // quest skills? + { + } + + public enum BlazeWizard : int + { + IncreasingMaxMP = 12000000, + MagicGuard = 12001001, + MagicArmor = 12001002, + MagicClaw = 12001003, + Flame = 12001004 + } + + public enum BlazeWizard2 : int + { + Meditation = 12101000, + Slow = 12101001, + FireArrow = 12101002, + Teleport = 12101003, + SpellBooster = 12101004, + ElementalReset = 12101005, + FirePillar = 12101006 + } + + public enum BlazeWizard3 : int + { + ElementalResistance = 12110000, + ElementAmplification = 12110001, + Seal = 12111002, + MeteorShower = 12111003, + Ifrit = 12111004, + FlameGear = 12111005, + FireStrike = 12111006 + } + + public enum BlazeWizard4 : int + { + } + + public enum WindArcher : int + { + CriticalShot = 13000000, + TheEyeofAmazon = 13000001, + Focus = 13001002, + DoubleShot = 13001003, + Storm = 13001004 + } + + public enum WindArcher2 : int + { + BowMastery = 13100000, + Thurst = 13100004, + BowBooster = 13101001, + FinalAttack = 13101002, + SoulArrow = 13101003, + StormBreak = 13101005, + WindWalk = 13101006 + } + + public enum WindArcher3 : int + { + BowExpert = 13110003, + ArrowRain = 13111000, + Strafe = 13111001, + Hurricane = 13111002, + Puppet = 13111004, + EagleEye = 13111005, + WindPiercing = 13111006, + WindShot = 13111007 + } + + public enum NightWalker : int + { + NimbleBody = 14000000, + KeenEyes = 14000001, + Disorder = 14001002, + DarkSight = 14001003, + LuckySeven = 14001004, + Darkness = 14001005 + } + + public enum NightWalker2 : int + { + ClawMastery = 14100000, + CriticalThrow = 14100001, + Vanish = 14100005, + ClawBooster = 14101002, + Haste = 14101003, + FlashJump = 14101004, + Vampire = 14101006 + } + + public enum NightWalker3 : int + { + Alchemist = 14110003, + Venom = 14110004, + ShadowPartner = 14111000, + ShadowWeb = 14111001, + Avenger = 14111002, + Triplethrow = 14111005, + PoisonBomb = 14111006 + } + + public enum NightWalker4 : int + { + } + + public enum ThunderBreaker : int + { + QuickMotion = 15000000, + Straight = 15001001, + SomersaultKick = 15001002, + Dash = 15001003, + Lightning = 15001004 + } + + public enum ThunderBreaker2 : int + { + ImproveMaxHP = 15100000, + KnucklerMastery = 15100001, + EnergyCharge = 15100004, + KnucklerBooster = 15101002, + CorkscrewBlow = 15101003, + EnergyBlast = 15101005, + LightningCharge = 15101006 + } + + public enum ThunderBreaker3 : int + { + CriticalPunch = 15110000, + EnergyDrain = 15111001, + Transformation = 15111002, + Shockwave = 15111003, + Barrage = 15111004, + SpeedInfusion = 15111005, + Spark = 15111006, + SharkWave = 15111007, + } + + public enum ThunderBreaker4 : int + { + } + + public enum Legend : int + { + //uninplemented + } + + public enum Aran : int //begginer aran + { + BlessingoftheFairy = 20000012, + FollowtheLead = 20000024, + ChairMastery = 20000100, + ThreeSnails = 20001000, + Recovery = 20001001, + AgileBody = 20001002, + LegendarySpirit = 20001003, + MonsterRider = 20001004, + EchoofHero = 20001005, + JumpDown = 20001006, + Maker = 20001007, + //dojoo/pyramid skills + BambooThrust = 20001009, + InvincibleBarrier = 20001010, + MeteoShower = 20001011, + } + + public enum Aran1 : int //1st job + { + ComboAbility = 21000000, + DoubleSwing = 21000002, + CombatStep = 21001001, + PolearmBooster = 21001003, + } + + public enum Aran2 : int //2nd job + { + PolearmMastery = 21100000, + TripleSwing = 21100001, + FinalCharge = 21100002, + ComboSmash = 21100004, + ComboDrain = 21100005, + BodyPressure = 21101003, + } + + /*public enum Aran3 : int //3rd job + { + ComboCritical + FullSwing + FinalCross + ComboFenrir + RollingSpin + (hidden)FullSwingDoubleSwing + (hidden)FullSwingTripleSwing + } + + public enum Aran4 : int //4rd job + { + SmartKnockback + SnowCharge + HighMastery + OverSwing + HighDefense + FinalBlow + ComboTempest + ComboBarrier + (hidden)OverSwing + (hidden)OverSwing + MapleWarrior + FreezeStanding + HerosWill = + }*/ + } + + public enum SecondaryBuffStat : long + { + HomingBeacon = 0x1, + Morph = 0x2, + Recovery = 0x4, + MapleWarrrior = 0x8, + Stance = 0x10, + SharpEyes = 0x20, + ManaReflection = 0x40, + ShadowClaw = 0x100, + Infinity = 0x200, + HolyShield = 0x400, + Hamstring = 0x800, + Blind = 0x1000, + Concentrate = 0x2000, + EchoOfHero = 0x8000, + GhostMorph = 0x20000, + Aura = 0x40000, + Confuse = 0x80000, + BerserkFury = 0x8000000, + DivineBody = 0x10000000, + FinalAttack = 0x80000000, + WeaponAttack = 0x100000000L, + WeaponDefense = 0x200000000L, + MagicAttack = 0x400000000L, + MagicDefense = 0x800000000L, + Accuracy = 0x1000000000L, + Avoid = 0x2000000000L, + Hands = 0x4000000000L, + Speed = 0x8000000000L, + Jump = 0x10000000000L, + MagicGuard = 0x20000000000L, + DarkSight = 0x40000000000L, + Booster = 0x80000000000L, + PowerGuard = 0x100000000000L, + HyperBodyHP = 0x200000000000L, + HyperBodyMP = 0x400000000000L, + Invincible = 0x800000000000L, + SoulArrow = 0x1000000000000L, + Stun = 0x2000000000000L, + Poison = 0x4000000000000L, + Seal = 0x8000000000000L, + Darkness = 0x10000000000000L, + Combo = 0x20000000000000L, + Summon = 0x20000000000000L, + WKCharge = 0x40000000000000L, + DragonBlood = 0x80000000000000L, + HolySymbol = 0x100000000000000L, + MesoUp = 0x200000000000000L, + ShadowPartner = 0x400000000000000L, + PickPocket = 0x800000000000000L, + Puppet = 0x800000000000000L, + MesoGuard = 0x1000000000000000L, + Weaken = 0x4000000000000000L, + } + + public enum PrimaryBuffStat : long + { + EnergyCharged = 0, + DashSpeed = 1, + DashJump = 2, + RideVehicle = 3, + PartyBooster = 4, + GuidedBullet = 5, + Undead = 6 + } + #endregion + } +} \ No newline at end of file diff --git a/src/Common/IO/ByteBuffer.cs b/src/Common/IO/ByteBuffer.cs index b7010e4..3a7ef2d 100644 --- a/src/Common/IO/ByteBuffer.cs +++ b/src/Common/IO/ByteBuffer.cs @@ -325,7 +325,7 @@ public int ReadInt() }*/ #if DEBUG - Log.Inform("ByteBuffer-ReadInt() count of int sized lenghts in reader stream: {0}", count); + Log.Inform("ByteBuffer-ReadInt() count of int sized lengths in reader stream: {0}", count); #endif int result = this.Reader.ReadInt32(); diff --git a/src/Common/Network/ClientHandler.cs b/src/Common/Network/ClientHandler.cs index 6a2ff52..ddb4e96 100644 --- a/src/Common/Network/ClientHandler.cs +++ b/src/Common/Network/ClientHandler.cs @@ -156,6 +156,7 @@ private void OnReceive(IAsyncResult ar) } catch (Exception e) { + Log.SkipLine(); Log.Error("Uncatched fatal error on {0}: ", e, this.Title.ToLower(), Thread.CurrentThread.ManagedThreadId); this.Stop(); } diff --git a/src/Common/Network/ServerHandler.cs b/src/Common/Network/ServerHandler.cs index 731e61a..b56865f 100644 --- a/src/Common/Network/ServerHandler.cs +++ b/src/Common/Network/ServerHandler.cs @@ -115,7 +115,9 @@ protected void OnReceive(IAsyncResult ar) } else { + Log.SkipLine(); Log.Hex("Received unknown (0x{0:X2}) packet: ", inPacket.Array, inPacket.OperationCode); + Log.SkipLine(); } this.Dispatch(inPacket); @@ -126,6 +128,7 @@ protected void OnReceive(IAsyncResult ar) } catch (Exception e) { + Log.SkipLine(); Log.Error("Uncatched fatal error on {0}: ", e, this.Title.ToLower()); this.Stop(); } diff --git a/src/WvsGame/Interoperability/CenterServer.cs b/src/WvsGame/Interoperability/CenterServer.cs index 400319c..a7b9191 100644 --- a/src/WvsGame/Interoperability/CenterServer.cs +++ b/src/WvsGame/Interoperability/CenterServer.cs @@ -9,6 +9,7 @@ using System; using System.Linq; using System.Net; +using Destiny.Constants; namespace Destiny.Interoperability { @@ -125,7 +126,7 @@ private void Register(Packet inPacket) WvsGame.PartyQuestExperienceRate = inPacket.ReadInt(); WvsGame.MesoRate = inPacket.ReadInt(); WvsGame.DropRate = inPacket.ReadInt(); - Log.Inform("Rates: {0}x / {1}x / {2}x / {3}x / {4}x.", + Log.Inform("Rates: \n ExpRate: {0}x \n QuestExpRate: {1}x \n PartyQuestExpRate: {2}x \n MesoRate: {3}x \n DropRate: {4}x", WvsGame.ExperienceRate, WvsGame.QuestExperienceRate, WvsGame.PartyQuestExperienceRate, @@ -200,7 +201,7 @@ private void CreateCharacter(Packet inPacket) { int accountID = inPacket.ReadInt(); string name = inPacket.ReadString(); - JobType jobType = (JobType)inPacket.ReadInt(); + CharacterConstants.JobType jobType = (CharacterConstants.JobType)inPacket.ReadInt(); int face = inPacket.ReadInt(); int hair = inPacket.ReadInt(); int hairColor = inPacket.ReadInt(); @@ -209,7 +210,7 @@ private void CreateCharacter(Packet inPacket) int bottomID = inPacket.ReadInt(); int shoesID = inPacket.ReadInt(); int weaponID = inPacket.ReadInt(); - Gender gender = (Gender)inPacket.ReadByte(); + CharacterConstants.Gender gender = (CharacterConstants.Gender)inPacket.ReadByte(); bool error = false; @@ -220,7 +221,7 @@ private void CreateCharacter(Packet inPacket) error = true; } - if (gender == Gender.Male) + if (gender == CharacterConstants.Gender.Male) { if (!DataProvider.CreationData.MaleSkins.Any(x => x.Item1 == jobType && x.Item2 == skin) || !DataProvider.CreationData.MaleFaces.Any(x => x.Item1 == jobType && x.Item2 == face) @@ -234,7 +235,7 @@ private void CreateCharacter(Packet inPacket) error = true; } } - else if (gender == Gender.Female) + else if (gender == CharacterConstants.Gender.Female) { if (!DataProvider.CreationData.FemaleSkins.Any(x => x.Item1 == jobType && x.Item2 == skin) || !DataProvider.CreationData.FemaleFaces.Any(x => x.Item1 == jobType && x.Item2 == face) @@ -263,7 +264,7 @@ private void CreateCharacter(Packet inPacket) character.Face = face; character.Hair = hair + hairColor; character.Level = 1; - character.Job = jobType == JobType.Cygnus ? Job.Noblesse : jobType == JobType.Explorer ? Job.Beginner : Job.Legend; + character.Job = jobType == CharacterConstants.JobType.Cygnus ? CharacterConstants.Job.Noblesse : jobType == CharacterConstants.JobType.Explorer ? CharacterConstants.Job.Beginner : CharacterConstants.Job.Legend; character.Strength = 12; character.Dexterity = 5; character.Intelligence = 4; @@ -276,7 +277,7 @@ private void CreateCharacter(Packet inPacket) character.SkillPoints = 0; character.Experience = 0; character.Fame = 0; - character.Map = DataProvider.Maps[jobType == JobType.Cygnus ? 130030000 : jobType == JobType.Explorer ? 10000 : 914000000]; + character.Map = DataProvider.Maps[jobType == CharacterConstants.JobType.Cygnus ? 130030000 : jobType == CharacterConstants.JobType.Explorer ? 10000 : 914000000]; character.SpawnPoint = 0; character.Meso = 0; @@ -284,7 +285,7 @@ private void CreateCharacter(Packet inPacket) character.Items.Add(new Item(bottomID, equipped: true)); character.Items.Add(new Item(shoesID, equipped: true)); character.Items.Add(new Item(weaponID, equipped: true)); - character.Items.Add(new Item(jobType == JobType.Cygnus ? 4161047 : jobType == JobType.Explorer ? 4161001 : 4161048), forceGetSlot: true); + character.Items.Add(new Item(jobType == CharacterConstants.JobType.Cygnus ? 4161047 : jobType == CharacterConstants.JobType.Explorer ? 4161001 : 4161048), forceGetSlot: true); character.Keymap.Add(new Shortcut(KeymapKey.One, KeymapAction.AllChat)); character.Keymap.Add(new Shortcut(KeymapKey.Two, KeymapAction.PartyChat)); diff --git a/src/WvsGame/Maple/Account.cs b/src/WvsGame/Maple/Account.cs index 25fe987..d1cb62a 100644 --- a/src/WvsGame/Maple/Account.cs +++ b/src/WvsGame/Maple/Account.cs @@ -2,6 +2,7 @@ using Destiny.Network; using System; using System.Data; +using Destiny.Constants; namespace Destiny.Maple { @@ -11,7 +12,7 @@ public sealed class Account public int ID { get; private set; } public string Username { get; set; } - public Gender Gender { get; set; } + public CharacterConstants.Gender Gender { get; set; } public bool IsMaster { get; set; } public DateTime Birthday { get; set; } public DateTime Creation { get; set; } @@ -40,7 +41,7 @@ public void Load(int accountID) this.Assigned = true; this.Username = (string)datum["Username"]; - this.Gender = (Gender)datum["Gender"]; + this.Gender = (CharacterConstants.Gender)datum["Gender"]; this.IsMaster = (bool)datum["IsMaster"]; this.Birthday = (DateTime)datum["Birthday"]; this.Creation = (DateTime)datum["Creation"]; diff --git a/src/WvsGame/Maple/Attack.cs b/src/WvsGame/Maple/Attack.cs index 431b599..f97d6bb 100644 --- a/src/WvsGame/Maple/Attack.cs +++ b/src/WvsGame/Maple/Attack.cs @@ -1,11 +1,12 @@ using Destiny.Network; using System.Collections.Generic; +using Destiny.Constants; namespace Destiny.Maple { public sealed class Attack { - public AttackType Type { get; private set; } + public CharacterConstants.AttackType Type { get; private set; } public byte Portals { get; private set; } public int Targets { get; private set; } public int Hits { get; private set; } @@ -20,7 +21,7 @@ public sealed class Attack public uint TotalDamage { get; private set; } public Dictionary> Damages { get; private set; } - public Attack(Packet iPacket, AttackType type) + public Attack(Packet iPacket, CharacterConstants.AttackType type) //TODO: recheck this seems wrong { this.Type = type; this.Portals = iPacket.ReadByte(); @@ -43,7 +44,7 @@ public Attack(Packet iPacket, AttackType type) this.WeaponSpeed = iPacket.ReadByte(); this.Ticks = iPacket.ReadInt(); - if (this.Type == AttackType.Range) + if (this.Type == CharacterConstants.AttackType.Range) { short starSlot = iPacket.ReadShort(); short cashStarSlot = iPacket.ReadShort(); @@ -74,13 +75,13 @@ public Attack(Packet iPacket, AttackType type) this.TotalDamage += damage; } - if (this.Type != AttackType.Summon) + if (this.Type != CharacterConstants.AttackType.Summon) { iPacket.ReadInt(); // NOTE: Unknown, probably CRC. } } - if (this.Type == AttackType.Range) + if (this.Type == CharacterConstants.AttackType.Range) { var pointRnged = new Point(iPacket.ReadShort(), iPacket.ReadShort()); } diff --git a/src/WvsGame/Maple/Buff.cs b/src/WvsGame/Maple/Buff.cs index 60e7868..8dc6469 100644 --- a/src/WvsGame/Maple/Buff.cs +++ b/src/WvsGame/Maple/Buff.cs @@ -4,6 +4,7 @@ using Destiny.Maple.Data; using System; using System.Collections.Generic; +using Destiny.Constants; using Destiny.Threading; namespace Destiny.Maple @@ -15,8 +16,8 @@ public sealed class Buff public int MapleID { get; set; } public byte SkillLevel { get; set; } public byte Type { get; set; } - public Dictionary PrimaryStatups { get; set; } - public Dictionary SecondaryStatups { get; set; } + public Dictionary PrimaryStatups { get; set; } + public Dictionary SecondaryStatups { get; set; } public DateTime End { get; set; } public int Value { get; set; } @@ -34,7 +35,7 @@ public long PrimaryBuffMask { long mask = 0; - foreach (KeyValuePair primaryStatup in this.PrimaryStatups) + foreach (KeyValuePair primaryStatup in this.PrimaryStatups) { mask |= (long)primaryStatup.Key; } @@ -49,7 +50,7 @@ public long SecondaryBuffMask { long mask = 0; - foreach (KeyValuePair secondaryStatus in this.SecondaryStatups) + foreach (KeyValuePair secondaryStatus in this.SecondaryStatups) { mask |= (long)secondaryStatus.Key; } @@ -66,8 +67,8 @@ public Buff(CharacterBuffs parent, Skill skill, int value) this.Type = 1; this.Value = value; this.End = DateTime.Now.AddSeconds(skill.BuffTime); - this.PrimaryStatups = new Dictionary(); - this.SecondaryStatups = new Dictionary(); + this.PrimaryStatups = new Dictionary(); + this.SecondaryStatups = new Dictionary(); this.CalculateStatups(skill); @@ -88,8 +89,8 @@ public Buff(CharacterBuffs parent, Datum datum) this.Type = (byte)datum["Type"]; this.Value = (int)datum["Value"]; this.End = (DateTime)datum["End"]; - this.PrimaryStatups = new Dictionary(); - this.SecondaryStatups = new Dictionary(); + this.PrimaryStatups = new Dictionary(); + this.SecondaryStatups = new Dictionary(); if (this.Type == 1) { @@ -131,7 +132,7 @@ public void Apply() .WriteLong(this.PrimaryBuffMask) .WriteLong(this.SecondaryBuffMask); - foreach (KeyValuePair primaryStatup in this.PrimaryStatups) + foreach (KeyValuePair primaryStatup in this.PrimaryStatups) { oPacket .WriteShort(primaryStatup.Value) @@ -139,7 +140,7 @@ public void Apply() .WriteInt((int)(this.End - DateTime.Now).TotalMilliseconds); } - foreach (KeyValuePair secondaryStatup in this.SecondaryStatups) + foreach (KeyValuePair secondaryStatup in this.SecondaryStatups) { oPacket .WriteShort(secondaryStatup.Value) @@ -163,12 +164,12 @@ public void Apply() .WriteLong(this.PrimaryBuffMask) .WriteLong(this.SecondaryBuffMask); - foreach (KeyValuePair primaryStatup in this.PrimaryStatups) + foreach (KeyValuePair primaryStatup in this.PrimaryStatups) { oPacket.WriteShort(primaryStatup.Value); } - foreach (KeyValuePair secondaryStatup in this.SecondaryStatups) + foreach (KeyValuePair secondaryStatup in this.SecondaryStatups) { oPacket.WriteShort(secondaryStatup.Value); } @@ -211,62 +212,62 @@ public void CalculateStatups(Skill skill) { if (skill.WeaponAttack > 0) { - this.SecondaryStatups.Add(SecondaryBuffStat.WeaponAttack, skill.WeaponAttack); + this.SecondaryStatups.Add(CharacterConstants.SecondaryBuffStat.WeaponAttack, skill.WeaponAttack); } if (skill.WeaponDefense > 0) { - this.SecondaryStatups.Add(SecondaryBuffStat.WeaponDefense, skill.WeaponDefense); + this.SecondaryStatups.Add(CharacterConstants.SecondaryBuffStat.WeaponDefense, skill.WeaponDefense); } if (skill.MagicAttack > 0) { - this.SecondaryStatups.Add(SecondaryBuffStat.MagicAttack, skill.MagicAttack); + this.SecondaryStatups.Add(CharacterConstants.SecondaryBuffStat.MagicAttack, skill.MagicAttack); } if (skill.MagicDefense > 0) { - this.SecondaryStatups.Add(SecondaryBuffStat.MagicDefense, skill.MagicDefense); + this.SecondaryStatups.Add(CharacterConstants.SecondaryBuffStat.MagicDefense, skill.MagicDefense); } if (skill.Accuracy > 0) { - this.SecondaryStatups.Add(SecondaryBuffStat.Accuracy, skill.Accuracy); + this.SecondaryStatups.Add(CharacterConstants.SecondaryBuffStat.Accuracy, skill.Accuracy); } if (skill.Avoidability > 0) { - this.SecondaryStatups.Add(SecondaryBuffStat.Avoid, skill.Avoidability); + this.SecondaryStatups.Add(CharacterConstants.SecondaryBuffStat.Avoid, skill.Avoidability); } if (skill.Speed > 0) { - this.SecondaryStatups.Add(SecondaryBuffStat.Speed, skill.Speed); + this.SecondaryStatups.Add(CharacterConstants.SecondaryBuffStat.Speed, skill.Speed); } if (skill.Jump > 0) { - this.SecondaryStatups.Add(SecondaryBuffStat.Jump, skill.Jump); + this.SecondaryStatups.Add(CharacterConstants.SecondaryBuffStat.Jump, skill.Jump); } if (skill.Morph > 0) { - this.SecondaryStatups.Add(SecondaryBuffStat.Morph, (short)(skill.Morph + 100 * (int)this.Character.Gender)); + this.SecondaryStatups.Add(CharacterConstants.SecondaryBuffStat.Morph, (short)(skill.Morph + 100 * (int)this.Character.Gender)); } switch (this.MapleID) { - case (int)SkillNames.SuperGM.HyperBody: - this.SecondaryStatups.Add(SecondaryBuffStat.HyperBodyHP, skill.ParameterA); - this.SecondaryStatups.Add(SecondaryBuffStat.HyperBodyMP, skill.ParameterB); + case (int)CharacterConstants.SkillNames.SuperGM.HyperBody: + this.SecondaryStatups.Add(CharacterConstants.SecondaryBuffStat.HyperBodyHP, skill.ParameterA); + this.SecondaryStatups.Add(CharacterConstants.SecondaryBuffStat.HyperBodyMP, skill.ParameterB); break; - case (int)SkillNames.SuperGM.HolySymbol: - this.SecondaryStatups.Add(SecondaryBuffStat.HolySymbol, skill.ParameterA); + case (int)CharacterConstants.SkillNames.SuperGM.HolySymbol: + this.SecondaryStatups.Add(CharacterConstants.SecondaryBuffStat.HolySymbol, skill.ParameterA); break; - case (int)SkillNames.SuperGM.Hide: - this.SecondaryStatups.Add(SecondaryBuffStat.DarkSight, skill.ParameterA); + case (int)CharacterConstants.SkillNames.SuperGM.Hide: + this.SecondaryStatups.Add(CharacterConstants.SecondaryBuffStat.DarkSight, skill.ParameterA); break; } } diff --git a/src/WvsGame/Maple/Characters/Character.cs b/src/WvsGame/Maple/Characters/Character.cs index cc5623e..932addf 100644 --- a/src/WvsGame/Maple/Characters/Character.cs +++ b/src/WvsGame/Maple/Characters/Character.cs @@ -1,6 +1,7 @@ using Destiny.Maple.Maps; using System; using System.Collections.Generic; +using Destiny.Constants; using Destiny.Maple.Commands; using Destiny.Maple.Life; using Destiny.Data; @@ -46,12 +47,12 @@ public sealed class Character : MapObject, IMoveable, ISpawnable private DateTime LastHealthHealOverTime = new DateTime(); private DateTime LastManaHealOverTime = new DateTime(); - private Gender gender; + private CharacterConstants.Gender gender; private byte skin; private int face; private int hair; private byte level; - private Job job; + private CharacterConstants.Job job; private short strength; private short dexterity; private short intelligence; @@ -69,7 +70,7 @@ public sealed class Character : MapObject, IMoveable, ISpawnable private Quest lastQuest; private string chalkboard; - public Gender Gender + public CharacterConstants.Gender Gender { get { @@ -108,7 +109,7 @@ public byte Skin if (this.IsInitialized) { - this.Update(StatisticType.Skin); + this.Update(CharacterConstants.StatisticType.Skin); this.UpdateApperance(); } } @@ -122,8 +123,8 @@ public int Face } set { - if ((this.Gender == Gender.Male && !DataProvider.Styles.MaleFaces.Contains(value)) || - this.Gender == Gender.Female && !DataProvider.Styles.FemaleFaces.Contains(value)) + if ((this.Gender == CharacterConstants.Gender.Male && !DataProvider.Styles.MaleFaces.Contains(value)) || + this.Gender == CharacterConstants.Gender.Female && !DataProvider.Styles.FemaleFaces.Contains(value)) { throw new StyleUnavailableException(); } @@ -132,7 +133,7 @@ public int Face if (this.IsInitialized) { - this.Update(StatisticType.Face); + this.Update(CharacterConstants.StatisticType.Face); this.UpdateApperance(); } } @@ -146,8 +147,8 @@ public int Hair } set { - if ((this.Gender == Gender.Male && !DataProvider.Styles.MaleHairs.Contains(value)) || - this.Gender == Gender.Female && !DataProvider.Styles.FemaleHairs.Contains(value)) + if ((this.Gender == CharacterConstants.Gender.Male && !DataProvider.Styles.MaleHairs.Contains(value)) || + this.Gender == CharacterConstants.Gender.Female && !DataProvider.Styles.FemaleHairs.Contains(value)) { throw new StyleUnavailableException(); } @@ -156,7 +157,7 @@ public int Hair if (this.IsInitialized) { - this.Update(StatisticType.Hair); + this.Update(CharacterConstants.StatisticType.Hair); this.UpdateApperance(); } } @@ -174,7 +175,7 @@ public int FaceStyleOffset { get { - return (this.Face - (10 * (this.Face / 10))) + (this.Gender == Gender.Male ? 20000 : 21000); + return (this.Face - (10 * (this.Face / 10))) + (this.Gender == CharacterConstants.Gender.Male ? 20000 : 21000); } } @@ -200,11 +201,11 @@ public void LevelUP(bool PlayEffect) level++; // update stats - this.Update(StatisticType.Level); + this.Update(CharacterConstants.StatisticType.Level); // generate randomized HP && MP bonus Random r = new Random(); - if (this.Job == Job.Beginner || this.Job == Job.Noblesse || this.Job == Job.Legend) + if (this.Job == CharacterConstants.Job.Beginner || this.Job == CharacterConstants.Job.Noblesse || this.Job == CharacterConstants.Job.Legend) { short rndHPbonus = Convert.ToInt16(r.Next(10, 16)); short rndMPbonus = Convert.ToInt16(r.Next(10, 12)); @@ -226,7 +227,7 @@ public void LevelUP(bool PlayEffect) { this.AbilityPoints += 6; } - else if (this.Job == Job.Beginner && this.Level < 8) + else if (this.Job == CharacterConstants.Job.Beginner && this.Level < 8) { this.AbilityPoints += 0; @@ -240,7 +241,7 @@ public void LevelUP(bool PlayEffect) this.Dexterity += 1; } } - else if (this.Job == Job.Beginner && this.Level == 8) + else if (this.Job == CharacterConstants.Job.Beginner && this.Level == 8) { this.Strength = 4; this.Dexterity = 4; @@ -252,7 +253,7 @@ public void LevelUP(bool PlayEffect) } // give SP - if (this.Job == Job.Beginner || this.Job == Job.Noblesse || this.Job == Job.Legend) + if (this.Job == CharacterConstants.Job.Beginner || this.Job == CharacterConstants.Job.Noblesse || this.Job == CharacterConstants.Job.Legend) { this.SkillPoints += 1; } @@ -263,7 +264,7 @@ public void LevelUP(bool PlayEffect) if (PlayEffect) { - this.ShowRemoteUserEffect(UserEffect.LevelUp); + this.ShowRemoteUserEffect(CharacterConstants.UserEffect.LevelUp); } } @@ -293,7 +294,7 @@ public byte Level { level = value; - this.Update(StatisticType.Level); + this.Update(CharacterConstants.StatisticType.Level); } else { @@ -311,7 +312,7 @@ public byte Level } // TODO: Update party's properties. - public Job Job + public CharacterConstants.Job Job { get { @@ -323,9 +324,9 @@ public Job Job if (this.IsInitialized) { - this.Update(StatisticType.Job); + this.Update(CharacterConstants.StatisticType.Job); - this.ShowRemoteUserEffect(UserEffect.JobChanged); + this.ShowRemoteUserEffect(CharacterConstants.UserEffect.JobChanged); } } } @@ -342,7 +343,7 @@ public short Strength if (this.IsInitialized) { - this.Update(StatisticType.Strength); + this.Update(CharacterConstants.StatisticType.Strength); } } } @@ -359,7 +360,7 @@ public short Dexterity if (this.IsInitialized) { - this.Update(StatisticType.Dexterity); + this.Update(CharacterConstants.StatisticType.Dexterity); } } } @@ -376,7 +377,7 @@ public short Intelligence if (this.IsInitialized) { - this.Update(StatisticType.Intelligence); + this.Update(CharacterConstants.StatisticType.Intelligence); } } } @@ -393,7 +394,7 @@ public short Luck if (this.IsInitialized) { - this.Update(StatisticType.Luck); + this.Update(CharacterConstants.StatisticType.Luck); } } } @@ -421,7 +422,7 @@ public short Health if (this.IsInitialized) { - this.Update(StatisticType.Health); + this.Update(CharacterConstants.StatisticType.Health); } } } @@ -438,7 +439,7 @@ public short MaxHealth if (this.IsInitialized) { - this.Update(StatisticType.MaxHealth); + this.Update(CharacterConstants.StatisticType.MaxHealth); } } } @@ -466,7 +467,7 @@ public short Mana if (this.IsInitialized) { - this.Update(StatisticType.Mana); + this.Update(CharacterConstants.StatisticType.Mana); } } } @@ -483,7 +484,7 @@ public short MaxMana if (this.IsInitialized) { - this.Update(StatisticType.MaxMana); + this.Update(CharacterConstants.StatisticType.MaxMana); } } } @@ -500,7 +501,7 @@ public short AbilityPoints if (this.IsInitialized) { - this.Update(StatisticType.AbilityPoints); + this.Update(CharacterConstants.StatisticType.AbilityPoints); } } } @@ -517,7 +518,7 @@ public short SkillPoints if (this.IsInitialized) { - this.Update(StatisticType.SkillPoints); + this.Update(CharacterConstants.StatisticType.SkillPoints); } } } @@ -535,31 +536,31 @@ public int Experience if (true) // NOTE: A server setting for multi-leveling. { - while (experience >= ExperienceTables.CharacterLevel[this.Level]) + while (experience >= CharacterConstants.ExperienceTables.CharacterLevel[this.Level]) { - experience -= ExperienceTables.CharacterLevel[this.Level]; + experience -= CharacterConstants.ExperienceTables.CharacterLevel[this.Level]; this.Level++; } } else { - if (experience >= ExperienceTables.CharacterLevel[this.Level]) + if (experience >= CharacterConstants.ExperienceTables.CharacterLevel[this.Level]) { - experience -= ExperienceTables.CharacterLevel[this.Level]; + experience -= CharacterConstants.ExperienceTables.CharacterLevel[this.Level]; this.Level++; } - if (experience >= ExperienceTables.CharacterLevel[this.Level]) + if (experience >= CharacterConstants.ExperienceTables.CharacterLevel[this.Level]) { - experience = ExperienceTables.CharacterLevel[this.Level] - 1; + experience = CharacterConstants.ExperienceTables.CharacterLevel[this.Level] - 1; } } if (this.IsInitialized && delta != 0) { - this.Update(StatisticType.Experience); + this.Update(CharacterConstants.StatisticType.Experience); } } } @@ -576,7 +577,7 @@ public short Fame if (this.IsInitialized) { - this.Update(StatisticType.Fame); + this.Update(CharacterConstants.StatisticType.Fame); } } } @@ -593,7 +594,7 @@ public int Meso if (this.IsInitialized) { - this.Update(StatisticType.Mesos); + this.Update(CharacterConstants.StatisticType.Mesos); } } } @@ -651,9 +652,25 @@ public Npc LastNpc { if (value == null) { - if (value.Scripts.ContainsKey(this)) + try { - value.Scripts.Remove(this); + if (value.Scripts.ContainsKey(this)) + { + value.Scripts.Remove(this); + } + } + catch(ArgumentNullException) + { + Log.SkipLine(); + Log.Error("Character-LastNPC thrown null exception!"); + Log.SkipLine(); + throw; + } + catch(Exception e) + { + Log.SkipLine(); + Log.Error("Character-LastNPC thrown exception: {0}!", e); + Log.SkipLine(); } } @@ -778,12 +795,12 @@ public void Load() this.AccountID = (int)datum["AccountID"]; this.WorldID = (byte)datum["WorldID"]; this.Name = (string)datum["Name"]; - this.Gender = (Gender)datum["Gender"]; + this.Gender = (CharacterConstants.Gender)datum["Gender"]; this.Skin = (byte)datum["Skin"]; this.Face = (int)datum["Face"]; this.Hair = (int)datum["Hair"]; this.Level = (byte)datum["Level"]; - this.Job = (Job)datum["Job"]; + this.Job = (CharacterConstants.Job)datum["Job"]; this.Strength = (short)datum["Strength"]; this.Dexterity = (short)datum["Dexterity"]; this.Intelligence = (short)datum["Intelligence"]; @@ -916,195 +933,195 @@ public void Initialize() } //TODO: hp/mp modification bugs out UI bars, add multiple stats, some kind of message to sideBar/chat - public static void giveStat(Character player, StatisticType stat, short quantity) + public static void giveStat(Character player, CharacterConstants.StatisticType stat, short quantity) { switch (stat) { - case StatisticType.Strength: + case CharacterConstants.StatisticType.Strength: int totalStrenght = player.strength + quantity; if (totalStrenght < short.MaxValue) { player.strength += quantity; - player.Update(StatisticType.Strength); + player.Update(CharacterConstants.StatisticType.Strength); break; } else { player.strength = short.MaxValue; - player.Update(StatisticType.Strength); + player.Update(CharacterConstants.StatisticType.Strength); break; } - case StatisticType.Dexterity: - int totalDexterity = player.strength + quantity; + case CharacterConstants.StatisticType.Dexterity: + int totalDexterity = player.dexterity + quantity; if (totalDexterity < short.MaxValue) { player.dexterity += quantity; - player.Update(StatisticType.Dexterity); + player.Update(CharacterConstants.StatisticType.Dexterity); break; } else { player.dexterity = short.MaxValue; - player.Update(StatisticType.Dexterity); + player.Update(CharacterConstants.StatisticType.Dexterity); break; } - case StatisticType.Intelligence: + case CharacterConstants.StatisticType.Intelligence: int totalIntelligence = player.intelligence + quantity; if (totalIntelligence < short.MaxValue) { player.intelligence += quantity; - player.Update(StatisticType.Intelligence); + player.Update(CharacterConstants.StatisticType.Intelligence); break; } else { player.intelligence = short.MaxValue; - player.Update(StatisticType.Intelligence); + player.Update(CharacterConstants.StatisticType.Intelligence); break; } - case StatisticType.Luck: - int totalLuck = player.strength + quantity; + case CharacterConstants.StatisticType.Luck: + int totalLuck = player.luck + quantity; if (totalLuck < short.MaxValue) { player.luck += quantity; - player.Update(StatisticType.Luck); + player.Update(CharacterConstants.StatisticType.Luck); break; } else { player.luck = short.MaxValue; - player.Update(StatisticType.Luck); + player.Update(CharacterConstants.StatisticType.Luck); break; } - case StatisticType.Health: + case CharacterConstants.StatisticType.Health: int totalHealth = player.Health + quantity; if (totalHealth < short.MaxValue) { player.health += quantity; - player.Update(StatisticType.Health); + player.Update(CharacterConstants.StatisticType.Health); break; } else { player.health = short.MaxValue; - player.Update(StatisticType.Health); + player.Update(CharacterConstants.StatisticType.Health); break; } - case StatisticType.MaxHealth: + case CharacterConstants.StatisticType.MaxHealth: int totalMaxHealth = player.maxHealth + quantity; if (totalMaxHealth < short.MaxValue) { player.maxHealth += quantity; - player.Update(StatisticType.MaxHealth); + player.Update(CharacterConstants.StatisticType.MaxHealth); break; } else { player.maxHealth = short.MaxValue; - player.Update(StatisticType.MaxHealth); + player.Update(CharacterConstants.StatisticType.MaxHealth); break; } - case StatisticType.Mana: + case CharacterConstants.StatisticType.Mana: int totalMana = player.mana + quantity; if (totalMana < short.MaxValue) { player.mana += quantity; - player.Update(StatisticType.Mana); + player.Update(CharacterConstants.StatisticType.Mana); break; } else { player.mana = short.MaxValue; - player.Update(StatisticType.Mana); + player.Update(CharacterConstants.StatisticType.Mana); break; } - case StatisticType.MaxMana: + case CharacterConstants.StatisticType.MaxMana: int totalMaxMana = player.maxMana + quantity; if (totalMaxMana < short.MaxValue) { player.maxMana += quantity; - player.Update(StatisticType.MaxMana); + player.Update(CharacterConstants.StatisticType.MaxMana); break; } else { player.maxMana = short.MaxValue; - player.Update(StatisticType.MaxMana); + player.Update(CharacterConstants.StatisticType.MaxMana); break; } - case StatisticType.AbilityPoints: + case CharacterConstants.StatisticType.AbilityPoints: int totalAbilityPoints = player.abilityPoints + quantity; if (totalAbilityPoints < short.MaxValue) { player.abilityPoints += quantity; - player.Update(StatisticType.AbilityPoints); + player.Update(CharacterConstants.StatisticType.AbilityPoints); break; } else { player.abilityPoints = short.MaxValue; - player.Update(StatisticType.AbilityPoints); + player.Update(CharacterConstants.StatisticType.AbilityPoints); break; } - case StatisticType.SkillPoints: + case CharacterConstants.StatisticType.SkillPoints: int totalSkillPoints = player.abilityPoints + quantity; if (totalSkillPoints < short.MaxValue) { player.skillPoints += quantity; - player.Update(StatisticType.SkillPoints); + player.Update(CharacterConstants.StatisticType.SkillPoints); break; } else { player.skillPoints = short.MaxValue; - player.Update(StatisticType.SkillPoints); + player.Update(CharacterConstants.StatisticType.SkillPoints); break; } - case StatisticType.Skin: break; - case StatisticType.Face: break; - case StatisticType.Hair: break; - case StatisticType.Level: break; - case StatisticType.Job: break; - case StatisticType.Experience: break; - case StatisticType.Fame: break; - case StatisticType.Mesos: break; - case StatisticType.Pet: break; - case StatisticType.GachaponExperience: break; + case CharacterConstants.StatisticType.Skin: break; + case CharacterConstants.StatisticType.Face: break; + case CharacterConstants.StatisticType.Hair: break; + case CharacterConstants.StatisticType.Level: break; + case CharacterConstants.StatisticType.Job: break; + case CharacterConstants.StatisticType.Experience: break; + case CharacterConstants.StatisticType.Fame: break; + case CharacterConstants.StatisticType.Mesos: break; + case CharacterConstants.StatisticType.Pet: break; + case CharacterConstants.StatisticType.GachaponExperience: break; default: throw new ArgumentOutOfRangeException(nameof(stat), stat, null); } } - public void Update(params StatisticType[] statistics) + public void Update(params CharacterConstants.StatisticType[] statistics) { using (Packet oPacket = new Packet(ServerOperationCode.StatChanged)) { @@ -1112,7 +1129,7 @@ public void Update(params StatisticType[] statistics) int flag = 0; - foreach (StatisticType statistic in statistics) + foreach (CharacterConstants.StatisticType statistic in statistics) { flag |= (int)statistic; } @@ -1121,79 +1138,79 @@ public void Update(params StatisticType[] statistics) Array.Sort(statistics); - foreach (StatisticType statistic in statistics) + foreach (CharacterConstants.StatisticType statistic in statistics) { switch (statistic) { - case StatisticType.Skin: + case CharacterConstants.StatisticType.Skin: oPacket.WriteByte(this.Skin); break; - case StatisticType.Face: + case CharacterConstants.StatisticType.Face: oPacket.WriteInt(this.Face); break; - case StatisticType.Hair: + case CharacterConstants.StatisticType.Hair: oPacket.WriteInt(this.Hair); break; - case StatisticType.Level: + case CharacterConstants.StatisticType.Level: oPacket.WriteByte(this.Level); break; - case StatisticType.Job: + case CharacterConstants.StatisticType.Job: oPacket.WriteShort((short)this.Job); break; - case StatisticType.Strength: + case CharacterConstants.StatisticType.Strength: oPacket.WriteShort(this.Strength); break; - case StatisticType.Dexterity: + case CharacterConstants.StatisticType.Dexterity: oPacket.WriteShort(this.Dexterity); break; - case StatisticType.Intelligence: + case CharacterConstants.StatisticType.Intelligence: oPacket.WriteShort(this.Intelligence); break; - case StatisticType.Luck: + case CharacterConstants.StatisticType.Luck: oPacket.WriteShort(this.Luck); break; - case StatisticType.Health: + case CharacterConstants.StatisticType.Health: oPacket.WriteShort(this.Health); break; - case StatisticType.MaxHealth: + case CharacterConstants.StatisticType.MaxHealth: oPacket.WriteShort(this.MaxHealth); break; - case StatisticType.Mana: + case CharacterConstants.StatisticType.Mana: oPacket.WriteShort(this.Mana); break; - case StatisticType.MaxMana: + case CharacterConstants.StatisticType.MaxMana: oPacket.WriteShort(this.MaxMana); break; - case StatisticType.AbilityPoints: + case CharacterConstants.StatisticType.AbilityPoints: oPacket.WriteShort(this.AbilityPoints); break; - case StatisticType.SkillPoints: + case CharacterConstants.StatisticType.SkillPoints: oPacket.WriteShort(this.SkillPoints); break; - case StatisticType.Experience: + case CharacterConstants.StatisticType.Experience: oPacket.WriteInt(this.Experience); break; - case StatisticType.Fame: + case CharacterConstants.StatisticType.Fame: oPacket.WriteShort(this.Fame); break; - case StatisticType.Mesos: + case CharacterConstants.StatisticType.Mesos: oPacket.WriteInt(this.Meso); break; } @@ -1346,7 +1363,7 @@ public void ChangeMap(int mapID, byte portalID = 0, bool fromPosition = false, P DataProvider.Maps[mapID].Characters.Add(this); } - public void AddAbility(StatisticType statistic, short mod, bool isReset) + public void AddAbility(CharacterConstants.StatisticType statistic, short mod, bool isReset) { short maxStat = short.MaxValue; // TODO: Should this be a setting? bool isSubtract = mod < 0; @@ -1355,7 +1372,7 @@ public void AddAbility(StatisticType statistic, short mod, bool isReset) { switch (statistic) { - case StatisticType.Strength: + case CharacterConstants.StatisticType.Strength: if (this.Strength >= maxStat) { return; @@ -1364,7 +1381,7 @@ public void AddAbility(StatisticType statistic, short mod, bool isReset) this.Strength += mod; break; - case StatisticType.Dexterity: + case CharacterConstants.StatisticType.Dexterity: if (this.Dexterity >= maxStat) { return; @@ -1373,7 +1390,7 @@ public void AddAbility(StatisticType statistic, short mod, bool isReset) this.Dexterity += mod; break; - case StatisticType.Intelligence: + case CharacterConstants.StatisticType.Intelligence: if (this.Intelligence >= maxStat) { return; @@ -1382,7 +1399,7 @@ public void AddAbility(StatisticType statistic, short mod, bool isReset) this.Intelligence += mod; break; - case StatisticType.Luck: + case CharacterConstants.StatisticType.Luck: if (this.Luck >= maxStat) { return; @@ -1391,8 +1408,8 @@ public void AddAbility(StatisticType statistic, short mod, bool isReset) this.Luck += mod; break; - case StatisticType.MaxHealth: - case StatisticType.MaxMana: + case CharacterConstants.StatisticType.MaxHealth: + case CharacterConstants.StatisticType.MaxMana: { // TODO: This is way too complicated for now. } @@ -1437,8 +1454,8 @@ public void Move(Packet iPacket) if (this.Foothold == 0) { // NOTE: Player is floating in the air. - // GMs might be legitmately in this state due to GM fly. - // We shouldn't mess with them because they have the tools toget out of falling off the map anyway. + // GMs might be legitimately in this state due to GM fly. + // We shouldn't mess with them because they have the tools to get out of falling off the map anyway. // TODO: Attempt to find foothold. // If none found, check the player fall counter. @@ -1502,7 +1519,7 @@ public void SitChair(Packet iPacket) } } - public void Attack(Packet iPacket, AttackType type) + public void Attack(Packet iPacket, CharacterConstants.AttackType type) { Attack attack = new Attack(iPacket, type); @@ -1516,45 +1533,129 @@ public void Attack(Packet iPacket, AttackType type) if (attack.SkillID > 0) { skill = this.Skills[attack.SkillID]; - skill.Cast(); } - // TODO: Modify packet based on attack type. - using (Packet oPacket = new Packet(ServerOperationCode.CloseRangeAttack)) + // TODO: further adjustments + switch (type) { - oPacket - .WriteInt(this.ID) - .WriteByte((byte)((attack.Targets * 0x10) + attack.Hits)) - .WriteByte() // NOTE: Unknown. - .WriteByte((byte)(attack.SkillID != 0 ? skill.CurrentLevel : 0)); // NOTE: Skill level. + case CharacterConstants.AttackType.Melee: + using (Packet oPacket = new Packet(ServerOperationCode.CloseRangeAttack)) + { + oPacket + .WriteInt(this.ID) + .WriteByte((byte)((attack.Targets * 0x10) + attack.Hits)) + .WriteByte() // NOTE: Unknown. + .WriteByte((byte)(attack.SkillID != 0 ? skill.CurrentLevel : 0)); // NOTE: Skill level. - if (attack.SkillID != 0) - { - oPacket.WriteInt(attack.SkillID); - } + if (attack.SkillID > 0) + { + oPacket.WriteInt(attack.SkillID); + } - oPacket - .WriteByte() // NOTE: Unknown. - .WriteByte(attack.Display) - .WriteByte(attack.Animation) - .WriteByte(attack.WeaponSpeed) - .WriteByte() // NOTE: Skill mastery. - .WriteInt(); // NOTE: Unknown. + oPacket + .WriteByte(attack.Display) // NOTE: display? + .WriteByte() // NOTE: direction? + .WriteByte(attack.Animation) // NOTE: stance? + .WriteByte(attack.WeaponSpeed) // NOTE: speed + .WriteByte() // NOTE: skill mastery? + .WriteInt(); // NOTE: projectile? - foreach (var target in attack.Damages) - { - oPacket - .WriteInt(target.Key) - .WriteByte(6); + foreach (var target in attack.Damages) + { + oPacket + .WriteInt(target.Key) + .WriteByte(6); + + foreach (uint hit in target.Value) + { + oPacket.WriteUInt(hit); + } + } + + this.Map.Broadcast(oPacket, this); + } + break; + + case CharacterConstants.AttackType.Magic: + using (Packet oPacket = new Packet(ServerOperationCode.MagicAttack)) + { + oPacket + .WriteInt(this.ID) + .WriteByte((byte)((attack.Targets * 0x10) + attack.Hits)) + .WriteByte() // NOTE: Unknown. + .WriteByte((byte)(attack.SkillID != 0 ? skill.CurrentLevel : 0)); // NOTE: Skill level. - foreach (uint hit in target.Value) + if (attack.SkillID > 0) + { + oPacket.WriteInt(attack.SkillID); + } + + oPacket + .WriteByte(attack.Display) // NOTE: display? + .WriteByte() // NOTE: direction? + .WriteByte(attack.Animation) // NOTE: stance? + .WriteByte(attack.WeaponSpeed) // NOTE: speed + .WriteByte() // NOTE: Skill mastery. + .WriteInt(); // NOTE: projectile? + + foreach (var target in attack.Damages) + { + oPacket + .WriteInt(target.Key) + .WriteByte(6); + + foreach (uint hit in target.Value) + { + oPacket.WriteUInt(hit); + } + } + + this.Map.Broadcast(oPacket, this); + } + break; + + case CharacterConstants.AttackType.Range: + using (Packet oPacket = new Packet(ServerOperationCode.RangedAttack)) { - oPacket.WriteUInt(hit); + oPacket + .WriteInt(this.ID) + .WriteByte((byte)((attack.Targets * 0x10) + attack.Hits)) + .WriteByte() // NOTE: Unknown. + .WriteByte((byte)(attack.SkillID != 0 ? skill.CurrentLevel : 0)); // NOTE: Skill level. + + if (attack.SkillID > 0) + { + oPacket.WriteInt(attack.SkillID); + } + + oPacket + .WriteByte(attack.Display) // NOTE: display? + .WriteByte() // NOTE: direction? + .WriteByte(attack.Animation) // NOTE: stance? + .WriteByte(attack.WeaponSpeed) // NOTE: speed + .WriteByte() // NOTE: Skill mastery. + .WriteInt(); // NOTE: projectile? + + foreach (var target in attack.Damages) + { + oPacket + .WriteInt(target.Key) + .WriteByte(6); + + foreach (uint hit in target.Value) + { + oPacket.WriteUInt(hit); + } + } + + this.Map.Broadcast(oPacket, this); } - } + break; - this.Map.Broadcast(oPacket, this); + case CharacterConstants.AttackType.Summon:break; + + default: throw new ArgumentOutOfRangeException(nameof(type), type, null); } foreach (KeyValuePair> target in attack.Damages) @@ -1580,9 +1681,9 @@ public void Attack(Packet iPacket, AttackType type) mob.Die(); } } - } + } } - + private const sbyte BumpDamage = -1; private const sbyte MapDamage = -2; @@ -1781,7 +1882,7 @@ public void Express(Packet iPacket) } } - public void ShowLocalUserEffect(UserEffect effect) + public void ShowLocalUserEffect(CharacterConstants.UserEffect effect) { using (Packet oPacket = new Packet(ServerOperationCode.Effect)) { @@ -1791,7 +1892,7 @@ public void ShowLocalUserEffect(UserEffect effect) } } - public void ShowRemoteUserEffect(UserEffect effect, bool skipSelf = false) + public void ShowRemoteUserEffect(CharacterConstants.UserEffect effect, bool skipSelf = false) { using (Packet oPacket = new Packet(ServerOperationCode.RemoteEffect)) { @@ -1823,31 +1924,31 @@ public void Converse(Npc npc, Quest quest = null) this.LastNpc.Converse(this); } - public void DistributeAP(StatisticType type, short amount = 1) + public void DistributeAP(CharacterConstants.StatisticType type, short amount = 1) { switch (type) { - case StatisticType.Strength: + case CharacterConstants.StatisticType.Strength: this.Strength += amount; break; - case StatisticType.Dexterity: + case CharacterConstants.StatisticType.Dexterity: this.Dexterity += amount; break; - case StatisticType.Intelligence: + case CharacterConstants.StatisticType.Intelligence: this.Intelligence += amount; break; - case StatisticType.Luck: + case CharacterConstants.StatisticType.Luck: this.Luck += amount; break; - case StatisticType.MaxHealth: + case CharacterConstants.StatisticType.MaxHealth: // TODO: Get addition based on other factors. break; - case StatisticType.MaxMana: + case CharacterConstants.StatisticType.MaxMana: // TODO: Get addition based on other factors. break; } @@ -1861,7 +1962,7 @@ public void DistributeAP(Packet iPacket) } iPacket.ReadInt(); // NOTE: Ticks. - StatisticType type = (StatisticType)iPacket.ReadInt(); + CharacterConstants.StatisticType type = (CharacterConstants.StatisticType)iPacket.ReadInt(); this.DistributeAP(type); this.AbilityPoints--; @@ -1876,7 +1977,7 @@ public void AutoDistributeAP(Packet iPacket) for (int i = 0; i < count; i++) { - StatisticType type = (StatisticType)iPacket.ReadInt(); + CharacterConstants.StatisticType type = (CharacterConstants.StatisticType)iPacket.ReadInt(); int amount = iPacket.ReadInt(); if (amount > this.AbilityPoints || amount < 0) @@ -1896,7 +1997,7 @@ public void HealOverTime(Packet iPacket) { iPacket.ReadInt(); // NOTE: Ticks. iPacket.ReadInt(); // NOTE: Unknown. - short healthAmount = iPacket.ReadShort(); // TODO: Validate + short healthAmount = iPacket.ReadShort(); // TODO: Validate short manaAmount = iPacket.ReadShort(); // TODO: Validate if (healthAmount != 0) @@ -2076,7 +2177,7 @@ public void MultiTalk(Packet iPacket) break; } - // NOTE: This is here for convinience. If you accidently use another text window (like party) and not the main text window, + // NOTE: This is here for convenience. If you accidentally use another text window (like party) and not the main text window, // your commands won't be shown but instead executed from there as well. if (text.StartsWith(Application.CommandIndiciator.ToString())) { @@ -2259,11 +2360,11 @@ public void UseAdminCommand(Packet iPacket) return; } - AdminCommandType type = (AdminCommandType)iPacket.ReadByte(); + CharacterConstants.AdminCommandType type = (CharacterConstants.AdminCommandType)iPacket.ReadByte(); switch (type) { - case AdminCommandType.Hide: + case CharacterConstants.AdminCommandType.Hide: { bool hide = iPacket.ReadBool(); @@ -2278,7 +2379,7 @@ public void UseAdminCommand(Packet iPacket) } break; - case AdminCommandType.Send: + case CharacterConstants.AdminCommandType.Send: { string name = iPacket.ReadString(); int destinationID = iPacket.ReadInt(); @@ -2303,7 +2404,7 @@ public void UseAdminCommand(Packet iPacket) } break; - case AdminCommandType.Summon: + case CharacterConstants.AdminCommandType.Summon: { int mobID = iPacket.ReadInt(); int count = iPacket.ReadInt(); @@ -2322,7 +2423,7 @@ public void UseAdminCommand(Packet iPacket) } break; - case AdminCommandType.CreateItem: + case CharacterConstants.AdminCommandType.CreateItem: { int itemID = iPacket.ReadInt(); @@ -2330,13 +2431,13 @@ public void UseAdminCommand(Packet iPacket) } break; - case AdminCommandType.DestroyFirstITem: + case CharacterConstants.AdminCommandType.DestroyFirstITem: { // TODO: What does this do? } break; - case AdminCommandType.GiveExperience: + case CharacterConstants.AdminCommandType.GiveExperience: { int amount = iPacket.ReadInt(); @@ -2344,7 +2445,7 @@ public void UseAdminCommand(Packet iPacket) } break; - case AdminCommandType.Ban: + case CharacterConstants.AdminCommandType.Ban: { string name = iPacket.ReadString(); @@ -2368,31 +2469,31 @@ public void UseAdminCommand(Packet iPacket) } break; - case AdminCommandType.Block: + case CharacterConstants.AdminCommandType.Block: { // TODO: Ban. } break; - case AdminCommandType.ShowMessageMap: + case CharacterConstants.AdminCommandType.ShowMessageMap: { // TODO: What does this do? } break; - case AdminCommandType.Snow: + case CharacterConstants.AdminCommandType.Snow: { // TODO: We have yet to implement map weather. } break; - case AdminCommandType.VarSetGet: + case CharacterConstants.AdminCommandType.VarSetGet: { // TODO: This seems useless. Should we implement this? } break; - case AdminCommandType.Warn: + case CharacterConstants.AdminCommandType.Warn: { string name = iPacket.ReadString(); string text = iPacket.ReadString(); @@ -2458,21 +2559,21 @@ public void EnterPortal(Packet iPacket) public void Report(Packet iPacket) { - ReportType type = (ReportType)iPacket.ReadByte(); + CharacterConstants.ReportType type = (CharacterConstants.ReportType)iPacket.ReadByte(); string victimName = iPacket.ReadString(); iPacket.ReadByte(); // NOTE: Unknown. string description = iPacket.ReadString(); - ReportResult result; + CharacterConstants.ReportResult result; switch (type) { - case ReportType.IllegalProgramUsage: + case CharacterConstants.ReportType.IllegalProgramUsage: { } break; - case ReportType.ConversationClaim: + case CharacterConstants.ReportType.ConversationClaim: { string chatLog = iPacket.ReadString(); } @@ -2501,11 +2602,11 @@ public void Report(Packet iPacket) { result = ReportResult.UnableToLocate; }*/ - result = ReportResult.Success; + result = CharacterConstants.ReportResult.Success; } else { - result = ReportResult.Max10TimesADay; + result = CharacterConstants.ReportResult.Max10TimesADay; } using (Packet oPacket = new Packet(ServerOperationCode.SueCharacterResult)) @@ -2686,7 +2787,7 @@ public byte[] DataToByteArray(long flag = long.MaxValue) } } - //TODO: theoreticly this could handle all kinds of messages to player like drops, mesos, guild points etc.... + //TODO: theoretically this could handle all kinds of messages to player like drops, mesos, guild points etc.... public static Packet GetShowSidebarInfoPacket(MessageType type, bool white, int itemID, int ammount, bool inChat, int partyBonus, int equipBonus) { @@ -2741,7 +2842,7 @@ public static Packet GetShowSidebarInfoPacket(MessageType type, bool white, int else { - Log.Inform("ERROR: unhandled MessageType: {0} encountered", type); + Log.Inform("ERROR: unhanded MessageType: {0} encountered", type); } return oPacket; diff --git a/src/WvsGame/Maple/Characters/CharacterBuffs.cs b/src/WvsGame/Maple/Characters/CharacterBuffs.cs index 9271243..5b40239 100644 --- a/src/WvsGame/Maple/Characters/CharacterBuffs.cs +++ b/src/WvsGame/Maple/Characters/CharacterBuffs.cs @@ -4,6 +4,7 @@ using System; using System.Collections; using System.Collections.Generic; +using Destiny.Constants; namespace Destiny.Maple.Characters { @@ -163,25 +164,25 @@ public byte[] ToByteArray() long mask = 0; int value = 0; - if (this.Contains((int)SkillNames.Rogue.DarkSight)) + if (this.Contains((int)CharacterConstants.SkillNames.Rogue.DarkSight)) { - mask |= (long)SecondaryBuffStat.DarkSight; + mask |= (long)CharacterConstants.SecondaryBuffStat.DarkSight; } - if (this.Contains((int)SkillNames.Crusader.ComboAttack)) + if (this.Contains((int)CharacterConstants.SkillNames.Crusader.ComboAttack)) { - mask |= (long)SecondaryBuffStat.Combo; - value = this[(int)SkillNames.Crusader.ComboAttack].Value; + mask |= (long)CharacterConstants.SecondaryBuffStat.Combo; + value = this[(int)CharacterConstants.SkillNames.Crusader.ComboAttack].Value; } - if (this.Contains((int)SkillNames.Hermit.ShadowPartner)) + if (this.Contains((int)CharacterConstants.SkillNames.Hermit.ShadowPartner)) { - mask |= (long)SecondaryBuffStat.ShadowPartner; + mask |= (long)CharacterConstants.SecondaryBuffStat.ShadowPartner; } - if (this.Contains((int)SkillNames.Hunter.SoulArrow) || this.Contains((int)SkillNames.Crossbowman.SoulArrow)) + if (this.Contains((int)CharacterConstants.SkillNames.Hunter.SoulArrowBow) || this.Contains((int)CharacterConstants.SkillNames.Crossbowman.SoulArrowCrossbow)) { - mask |= (long)SecondaryBuffStat.SoulArrow; + mask |= (long)CharacterConstants.SecondaryBuffStat.SoulArrow; } oPacket.WriteInt((int)((mask >> 32) & 0xFFFFFFFFL)); diff --git a/src/WvsGame/Maple/Characters/CharacterItems.cs b/src/WvsGame/Maple/Characters/CharacterItems.cs index 45a8665..d70f278 100644 --- a/src/WvsGame/Maple/Characters/CharacterItems.cs +++ b/src/WvsGame/Maple/Characters/CharacterItems.cs @@ -5,6 +5,7 @@ using Destiny.Data; using Destiny.Network; using System.Linq; +using Destiny.Constants; using Destiny.Maple.Data; using Destiny.Maple.Life; using Destiny.IO; @@ -461,8 +462,8 @@ public void UseCashItem(Packet iPacket) case 5050000: // NOTE: AP Reset. { - StatisticType statDestination = (StatisticType)iPacket.ReadInt(); - StatisticType statSource = (StatisticType)iPacket.ReadInt(); + CharacterConstants.StatisticType statDestination = (CharacterConstants.StatisticType)iPacket.ReadInt(); + CharacterConstants.StatisticType statSource = (CharacterConstants.StatisticType)iPacket.ReadInt(); this.Parent.AddAbility(statDestination, 1, true); this.Parent.AddAbility(statSource, -1, true); diff --git a/src/WvsGame/Maple/Characters/CharacterQuests.cs b/src/WvsGame/Maple/Characters/CharacterQuests.cs index ff84c7f..c08a413 100644 --- a/src/WvsGame/Maple/Characters/CharacterQuests.cs +++ b/src/WvsGame/Maple/Characters/CharacterQuests.cs @@ -3,6 +3,7 @@ using Destiny.Maple.Data; using System; using System.Collections.Generic; +using Destiny.Constants; using Destiny.Maple.Life; using Destiny.IO; @@ -274,7 +275,7 @@ public void Complete(Quest quest, int selection) // TODO: Meso gain packet in chat. - foreach (KeyValuePair skill in quest.PostSkillRewards) + foreach (KeyValuePair skill in quest.PostSkillRewards) { if (this.Parent.Job == skill.Value) { @@ -326,7 +327,7 @@ public void Complete(Quest quest, int selection) using (Packet oPacket = new Packet(ServerOperationCode.Effect)) { oPacket - .WriteByte((byte)UserEffect.Quest) + .WriteByte((byte)CharacterConstants.UserEffect.Quest) .WriteByte(1) .WriteInt(item.Key) .WriteInt(item.Value); @@ -342,8 +343,8 @@ public void Complete(Quest quest, int selection) this.Completed.Add(quest.MapleID, DateTime.UtcNow); - this.Parent.ShowLocalUserEffect(UserEffect.QuestComplete); - this.Parent.ShowRemoteUserEffect(UserEffect.QuestComplete, true); + this.Parent.ShowLocalUserEffect(CharacterConstants.UserEffect.QuestComplete); + this.Parent.ShowRemoteUserEffect(CharacterConstants.UserEffect.QuestComplete, true); } public void Forfeit(ushort questID) diff --git a/src/WvsGame/Maple/Characters/CharacterSkills.cs b/src/WvsGame/Maple/Characters/CharacterSkills.cs index 1a5718f..e3433aa 100644 --- a/src/WvsGame/Maple/Characters/CharacterSkills.cs +++ b/src/WvsGame/Maple/Characters/CharacterSkills.cs @@ -1,6 +1,7 @@ using Destiny.Data; using System.Collections.Generic; using System.Collections.ObjectModel; +using Destiny.Constants; using Destiny.Network; using Destiny.IO; @@ -58,7 +59,7 @@ public void Cast(Packet iPacket) switch (skill.MapleID) { - case (int)SkillNames.SuperGM.Resurrection: + case (int)CharacterConstants.SkillNames.SuperGM.Resurrection: { byte targets = iPacket.ReadByte(); diff --git a/src/WvsGame/Maple/Commands/Implementation/JobCommand.cs b/src/WvsGame/Maple/Commands/Implementation/JobCommand.cs index 51a708c..c560001 100644 --- a/src/WvsGame/Maple/Commands/Implementation/JobCommand.cs +++ b/src/WvsGame/Maple/Commands/Implementation/JobCommand.cs @@ -1,5 +1,6 @@ using Destiny.Maple.Characters; using System; +using Destiny.Constants; namespace Destiny.Maple.Commands.Implementation { @@ -41,9 +42,9 @@ public override void Execute(Character caller, string[] args) { short jobID = short.Parse(args[0]); - if (Enum.IsDefined(typeof(Job), jobID)) + if (Enum.IsDefined(typeof(CharacterConstants.Job), jobID)) { - caller.Job = (Job)jobID; + caller.Job = (CharacterConstants.Job)jobID; } else { @@ -54,7 +55,7 @@ public override void Execute(Character caller, string[] args) { try { - caller.Job = (Job)Enum.Parse(typeof(Job), args[0], true); + caller.Job = (CharacterConstants.Job)Enum.Parse(typeof(CharacterConstants.Job), args[0], true); } catch (ArgumentException) { diff --git a/src/WvsGame/Maple/Commands/Implementation/LearnSkillCommand.cs b/src/WvsGame/Maple/Commands/Implementation/LearnSkillCommand.cs new file mode 100644 index 0000000..a73d062 --- /dev/null +++ b/src/WvsGame/Maple/Commands/Implementation/LearnSkillCommand.cs @@ -0,0 +1,72 @@ +using System; +using Destiny.Maple.Characters; +using Destiny.Maple.Data; +using System.Linq; + +namespace Destiny.Maple.Commands.Implementation +{ + public sealed class LearnSkillCommand : Command + { + public override string Name + { + get + { + return "learn"; + } + } + + public override string Parameters + { + get + { + return "{ skillID } [ skillLvl ]"; + } + } + + public override bool IsRestricted + { + get + { + return true; + } + } + + public override void Execute(Character caller, string[] args) + { + if (args.Length < 1) + { + this.ShowSyntax(caller); + } + else + { + int skillID = int.Parse(args[0]); + int skillLVL = int.Parse(args[1]); + + if (DataProvider.Skills.ContainsKey(skillID)) + { + if (caller.Skills.Contains(skillID)) + { + Skill skillToModify = caller.Skills[skillID]; + + skillToModify.CurrentLevel = (byte)skillLVL; + skillToModify.Update(); + } + else if(!caller.Skills.Contains(skillID)) + { + Skill skillToAdd = new Skill(skillID); + + skillToAdd.CurrentLevel = (byte) skillLVL; + skillToAdd.MapleID = skillID; + skillToAdd.Update(); + } + } + else + { + caller.Notify("[Command] Invalid skill ID."); + } + + } + } + + } +} \ No newline at end of file diff --git a/src/WvsGame/Maple/Commands/Implementation/ModifyStatCommand.cs b/src/WvsGame/Maple/Commands/Implementation/ModifyStatCommand.cs index 81cd7dc..4e22462 100644 --- a/src/WvsGame/Maple/Commands/Implementation/ModifyStatCommand.cs +++ b/src/WvsGame/Maple/Commands/Implementation/ModifyStatCommand.cs @@ -1,4 +1,5 @@ -using Destiny.Maple.Characters; +using Destiny.Constants; +using Destiny.Maple.Characters; namespace Destiny.Maple.Commands.Implementation { @@ -49,39 +50,39 @@ public override void Execute(Character caller, string[] args) } string stat = args[0]; - StatisticType type = StatisticType.None; + CharacterConstants.StatisticType type = CharacterConstants.StatisticType.None; switch (stat) { case "str": - type = StatisticType.Strength; + type = CharacterConstants.StatisticType.Strength; break; case "dex": - type = StatisticType.Dexterity; + type = CharacterConstants.StatisticType.Dexterity; break; case "int": - type = StatisticType.Intelligence; + type = CharacterConstants.StatisticType.Intelligence; break; case "luck": - type = StatisticType.Luck; + type = CharacterConstants.StatisticType.Luck; break; case "hp": - type = StatisticType.Health; + type = CharacterConstants.StatisticType.Health; break; case "maxhp": - type = StatisticType.MaxHealth; + type = CharacterConstants.StatisticType.MaxHealth; break; case "mp": - type = StatisticType.Mana; + type = CharacterConstants.StatisticType.Mana; break; case "maxmp": - type = StatisticType.MaxMana; + type = CharacterConstants.StatisticType.MaxMana; break; case "ap": - type = StatisticType.AbilityPoints; + type = CharacterConstants.StatisticType.AbilityPoints; break; case "sp": - type = StatisticType.SkillPoints; + type = CharacterConstants.StatisticType.SkillPoints; break; } diff --git a/src/WvsGame/Maple/Data/CachedQuests.cs b/src/WvsGame/Maple/Data/CachedQuests.cs index d87f62b..bd05b0f 100644 --- a/src/WvsGame/Maple/Data/CachedQuests.cs +++ b/src/WvsGame/Maple/Data/CachedQuests.cs @@ -1,6 +1,7 @@ using Destiny.Data; using Destiny.IO; using System.Collections.ObjectModel; +using Destiny.Constants; namespace Destiny.Maple.Data { @@ -113,11 +114,11 @@ public CachedQuests() { if (state == 0) { - this[(ushort)(int)datum["questid"]].PreSkillRewards.Add(new Skill((int)datum["rewardid"], (byte)(short)datum["quantity"], (byte)(short)datum["master_level"]), (Job)datum["job"]); + this[(ushort)(int)datum["questid"]].PreSkillRewards.Add(new Skill((int)datum["rewardid"], (byte)(short)datum["quantity"], (byte)(short)datum["master_level"]), (CharacterConstants.Job)datum["job"]); } else { - this[(ushort)(int)datum["questid"]].PostSkillRewards.Add(new Skill((int)datum["rewardid"], (byte)(short)datum["quantity"], (byte)(short)datum["master_level"]), (Job)datum["job"]); + this[(ushort)(int)datum["questid"]].PostSkillRewards.Add(new Skill((int)datum["rewardid"], (byte)(short)datum["quantity"], (byte)(short)datum["master_level"]), (CharacterConstants.Job)datum["job"]); } } break; @@ -138,7 +139,7 @@ public CachedQuests() foreach (Datum datum in new Datums("quest_required_jobs").Populate()) { - this[(ushort)datum["questid"]].ValidJobs.Add((Job)datum["valid_jobid"]); + this[(ushort)datum["questid"]].ValidJobs.Add((CharacterConstants.Job)datum["valid_jobid"]); } } } diff --git a/src/WvsGame/Maple/Data/CreationData.cs b/src/WvsGame/Maple/Data/CreationData.cs index af890a3..579020b 100644 --- a/src/WvsGame/Maple/Data/CreationData.cs +++ b/src/WvsGame/Maple/Data/CreationData.cs @@ -3,6 +3,7 @@ using System; using System.Collections.Generic; using System.Linq; +using Destiny.Constants; namespace Destiny.Maple.Data { @@ -10,41 +11,41 @@ public sealed class CreationData { public List ForbiddenNames { get; private set; } - public List> MaleSkins { get; private set; } - public List> FemaleSkins { get; private set; } - public List> MaleFaces { get; private set; } - public List> FemaleFaces { get; private set; } - public List> MaleHairs { get; private set; } - public List> FemaleHairs { get; private set; } - public List> MaleHairColors { get; private set; } - public List> FemaleHairColors { get; private set; } - public List> MaleTops { get; private set; } - public List> FemaleTops { get; private set; } - public List> MaleBottoms { get; private set; } - public List> FemaleBottoms { get; private set; } - public List> MaleShoes { get; private set; } - public List> FemaleShoes { get; private set; } - public List> MaleWeapons { get; private set; } - public List> FemaleWeapons { get; private set; } + public List> MaleSkins { get; private set; } + public List> FemaleSkins { get; private set; } + public List> MaleFaces { get; private set; } + public List> FemaleFaces { get; private set; } + public List> MaleHairs { get; private set; } + public List> FemaleHairs { get; private set; } + public List> MaleHairColors { get; private set; } + public List> FemaleHairColors { get; private set; } + public List> MaleTops { get; private set; } + public List> FemaleTops { get; private set; } + public List> MaleBottoms { get; private set; } + public List> FemaleBottoms { get; private set; } + public List> MaleShoes { get; private set; } + public List> FemaleShoes { get; private set; } + public List> MaleWeapons { get; private set; } + public List> FemaleWeapons { get; private set; } public CreationData() { - this.MaleSkins = new List>(); - this.FemaleSkins = new List>(); - this.MaleFaces = new List>(); - this.FemaleFaces = new List>(); - this.MaleHairs = new List>(); - this.FemaleHairs = new List>(); - this.MaleHairColors = new List>(); - this.FemaleHairColors = new List>(); - this.MaleTops = new List>(); - this.FemaleTops = new List>(); - this.MaleBottoms = new List>(); - this.FemaleBottoms = new List>(); - this.MaleShoes = new List>(); - this.FemaleShoes = new List>(); - this.MaleWeapons = new List>(); - this.FemaleWeapons = new List>(); + this.MaleSkins = new List>(); + this.FemaleSkins = new List>(); + this.MaleFaces = new List>(); + this.FemaleFaces = new List>(); + this.MaleHairs = new List>(); + this.FemaleHairs = new List>(); + this.MaleHairColors = new List>(); + this.FemaleHairColors = new List>(); + this.MaleTops = new List>(); + this.FemaleTops = new List>(); + this.MaleBottoms = new List>(); + this.FemaleBottoms = new List>(); + this.MaleShoes = new List>(); + this.FemaleShoes = new List>(); + this.MaleWeapons = new List>(); + this.FemaleWeapons = new List>(); using (Log.Load("Character Creation Data")) { @@ -54,57 +55,57 @@ public CreationData() { string gender = (string)datum["gender"]; string charType = (string)datum["character_type"]; - JobType jobType = charType == "aran" ? JobType.Aran : (charType == "cygnus" ? JobType.Cygnus : JobType.Explorer); + CharacterConstants.JobType jobType = charType == "aran" ? CharacterConstants.JobType.Aran : (charType == "cygnus" ? CharacterConstants.JobType.Cygnus : CharacterConstants.JobType.Explorer); switch ((string)datum["object_type"]) { case "skin": if(gender == "male" || gender == "both") - this.MaleSkins.Add(new Tuple(jobType, (byte)(int)datum["objectid"])); + this.MaleSkins.Add(new Tuple(jobType, (byte)(int)datum["objectid"])); if(gender == "female" || gender == "both") - this.FemaleSkins.Add(new Tuple(jobType, (byte)(int)datum["objectid"])); + this.FemaleSkins.Add(new Tuple(jobType, (byte)(int)datum["objectid"])); break; case "face": if (gender == "male" || gender == "both") - this.MaleFaces.Add(new Tuple(jobType, (int)datum["objectid"])); + this.MaleFaces.Add(new Tuple(jobType, (int)datum["objectid"])); if (gender == "female" || gender == "both") - this.FemaleFaces.Add(new Tuple(jobType, (int)datum["objectid"])); + this.FemaleFaces.Add(new Tuple(jobType, (int)datum["objectid"])); break; case "hair": if (gender == "male" || gender == "both") - this.MaleHairs.Add(new Tuple(jobType, (int)datum["objectid"])); + this.MaleHairs.Add(new Tuple(jobType, (int)datum["objectid"])); if (gender == "female" || gender == "both") - this.FemaleHairs.Add(new Tuple(jobType, (int)datum["objectid"])); + this.FemaleHairs.Add(new Tuple(jobType, (int)datum["objectid"])); break; case "haircolor": if (gender == "male" || gender == "both") - this.MaleHairColors.Add(new Tuple(jobType, (byte)(int)datum["objectid"])); + this.MaleHairColors.Add(new Tuple(jobType, (byte)(int)datum["objectid"])); if (gender == "female" || gender == "both") - this.FemaleHairColors.Add(new Tuple(jobType, (byte)(int)datum["objectid"])); + this.FemaleHairColors.Add(new Tuple(jobType, (byte)(int)datum["objectid"])); break; case "top": if (gender == "male" || gender == "both") - this.MaleTops.Add(new Tuple(jobType, (int)datum["objectid"])); + this.MaleTops.Add(new Tuple(jobType, (int)datum["objectid"])); if (gender == "female" || gender == "both") - this.FemaleTops.Add(new Tuple(jobType, (int)datum["objectid"])); + this.FemaleTops.Add(new Tuple(jobType, (int)datum["objectid"])); break; case "bottom": if (gender == "male" || gender == "both") - this.MaleBottoms.Add(new Tuple(jobType, (int)datum["objectid"])); + this.MaleBottoms.Add(new Tuple(jobType, (int)datum["objectid"])); if (gender == "female" || gender == "both") - this.FemaleBottoms.Add(new Tuple(jobType, (int)datum["objectid"])); + this.FemaleBottoms.Add(new Tuple(jobType, (int)datum["objectid"])); break; case "shoes": if (gender == "male" || gender == "both") - this.MaleShoes.Add(new Tuple(jobType, (int)datum["objectid"])); + this.MaleShoes.Add(new Tuple(jobType, (int)datum["objectid"])); if (gender == "female" || gender == "both") - this.FemaleShoes.Add(new Tuple(jobType, (int)datum["objectid"])); + this.FemaleShoes.Add(new Tuple(jobType, (int)datum["objectid"])); break; case "weapon": if (gender == "male" || gender == "both") - this.MaleWeapons.Add(new Tuple(jobType, (int)datum["objectid"])); + this.MaleWeapons.Add(new Tuple(jobType, (int)datum["objectid"])); if (gender == "female" || gender == "both") - this.FemaleWeapons.Add(new Tuple(jobType, (int)datum["objectid"])); + this.FemaleWeapons.Add(new Tuple(jobType, (int)datum["objectid"])); break; } } diff --git a/src/WvsGame/Maple/Experience.cs b/src/WvsGame/Maple/Experience.cs index 14420fe..5e5e8f2 100644 --- a/src/WvsGame/Maple/Experience.cs +++ b/src/WvsGame/Maple/Experience.cs @@ -1,5 +1,6 @@ using Destiny.Maple.Characters; using Destiny.Network; +using Destiny.Constants; namespace Destiny.Maple { @@ -15,6 +16,11 @@ public Experience(int amount) public const int GivenExpLimit = int.MaxValue; + public static int GetExpNeededForLevel(int level) + { + return level > 200 ? 2000000000 : CharacterConstants.ExperienceTables.CharacterLevel[level]; + } + public static void giveExp(Character character, int exp) { long myPlusGivenExp = (long)character.Experience + (long)exp; diff --git a/src/WvsGame/Maple/Item.cs b/src/WvsGame/Maple/Item.cs index 46ac60e..3eaa14b 100644 --- a/src/WvsGame/Maple/Item.cs +++ b/src/WvsGame/Maple/Item.cs @@ -5,6 +5,7 @@ using Destiny.Maple.Maps; using System; using System.Collections.Generic; +using Destiny.Constants; using Destiny.IO; namespace Destiny.Maple @@ -66,7 +67,7 @@ public static ItemType GetType(int mapleID) public short RequiredIntelligence { get; private set; } public short RequiredLuck { get; private set; } public short RequiredFame { get; private set; } - public Job RequiredJob { get; private set; } + public CharacterConstants.Job RequiredJob { get; private set; } // Consume data properties are prefixed with 'C'. public int CItemId { get; private set; } diff --git a/src/WvsGame/Maple/Life/Mist.cs b/src/WvsGame/Maple/Life/Mist.cs new file mode 100644 index 0000000..e972a9d --- /dev/null +++ b/src/WvsGame/Maple/Life/Mist.cs @@ -0,0 +1,108 @@ +using Destiny.Constants; +using Destiny.Maple.Characters; +using Destiny.Maple.Maps; +using Destiny.Network; + +namespace Destiny.Maple.Life +{ + public sealed class Mist : MapObject, ISpawnable + { + private Rectangle mistPosition { get; set; } + public Character mistOwner { get; set; } + public Skill mistSkill { get; set; } + + public enum MistType : int + { + mobMist = 0, + playerPoisonMist = 1, + playerSmokescreen = 2, + unknown = 3, + recoveryMist = 4 + // flame gear + // poison bomb + } + + public MistType mistType { get; set; } + + public MistType getMistType() + { + switch (this.mistSkill.MapleID) + { + case (int) CharacterConstants.SkillNames.FirePoisonMage.PoisonMist: + return MistType.playerPoisonMist; + + case (int) CharacterConstants.SkillNames.Shadower.Smokescreen: + return MistType.playerSmokescreen; + } + + return MistType.mobMist; + } + + public Mist(Rectangle boundingBox, Character character, Skill skill) + { + this.ObjectID = ObjectID; + this.mistSkill = skill; + this.mistType = getMistType(); + this.mistOwner = character; + this.mistPosition = boundingBox; + } + + public Mist MistObject(Rectangle boundingBox, Character character, Skill skill) + { + this.ObjectID = ObjectID; + this.mistSkill = skill; + this.mistType = getMistType(); + this.mistOwner = character; + this.mistPosition = boundingBox; + + return this; + } + + public static void SpawnMist(GameClient client, Mist mistToSpawn) + { + Packet mistPacket = mistToSpawn.GetCreatePacket(); + + client.Send(mistPacket); + } + + public Packet GetCreatePacket() + { + return this.GetSpawnPacket(); + } + + public Packet GetSpawnPacket() + { + return this.GetInternalPacket(); + } + + private Packet GetInternalPacket() + { + Packet oPacket = new Packet(ServerOperationCode.AffectedAreaCreated); + + oPacket + .WriteInt(this.ObjectID) + .WriteInt((int)this.mistType) + .WriteInt(this.mistOwner.ID) + .WriteInt(this.mistSkill.MapleID) + .WriteByte(this.mistSkill.CurrentLevel) + .WriteShort((short)this.mistSkill.Cooldown) + .WriteInt(this.mistPosition.RB.X) + .WriteInt(this.mistPosition.RB.Y) + .WriteInt(this.mistPosition.RB.X + this.mistPosition.LT.Y) + .WriteInt(this.mistPosition.RB.Y + this.mistPosition.LT.Y) + .WriteInt(0); // ??? + + return oPacket; + } + + public Packet GetDestroyPacket() + { + Packet oPacket = new Packet(ServerOperationCode.AffectedAreaRemoved); + + oPacket.WriteInt(this.ObjectID); + + return oPacket; + } + + } +} \ No newline at end of file diff --git a/src/WvsGame/Maple/Life/Mob.cs b/src/WvsGame/Maple/Life/Mob.cs index 103738d..460c98b 100644 --- a/src/WvsGame/Maple/Life/Mob.cs +++ b/src/WvsGame/Maple/Life/Mob.cs @@ -13,11 +13,7 @@ namespace Destiny.Maple.Life public sealed class Mob : MapObject, IMoveable, ISpawnable, IControllable { public int MapleID { get; private set; } - public Character Controller - { - get; //TODO: overflows due to unhandled MapObjects errors - set; - } + public Character Controller { get; set; } public Dictionary Attackers { get; private set; } public SpawnPoint SpawnPoint { get; private set; } public byte Stance { get; set; } @@ -223,7 +219,7 @@ public void AssignController() catch (Exception e) { Log.SkipLine(); - Log.Inform("ERROR: AssignController() failed to add mobObject: {0} to newController.ControlledMobs! \n Exception occured: {1}", this.ObjectID, e); + Log.Inform("ERROR: AssignController() failed to add mobObject: {0} to newController.ControlledMobs! \n Exception occurred: {1}", this.ObjectID, e); Log.SkipLine(); } @@ -237,31 +233,34 @@ public void SwitchController(Character newController) { if (this.Controller != newController) { - if (this.Controller.ControlledMobs.Contains(this)) + if (this != null) { - try - { - this.Controller.ControlledMobs.Remove(this); - } - catch (Exception e) + if (this.Controller.ControlledMobs.Contains(this)) { - Log.SkipLine(); - Log.Inform("ERROR: SwitchController() failed to remove mobObject: {0} from this.Controller.ControlledMobs! \n Exception occured: {1}", this.ObjectID, e); - Log.SkipLine(); + try + { + this.Controller.ControlledMobs.Remove(this); + } + catch (Exception e) + { + Log.SkipLine(); + Log.Inform("ERROR: SwitchController() failed to remove mobObject: {0} from this.Controller.ControlledMobs! \n Exception occurred: {1}", this.ObjectID, e); + Log.SkipLine(); + } } - } - if (!newController.ControlledMobs.Contains(this)) - { - try - { - newController.ControlledMobs.Add(this); - } - catch (Exception e) + if (!newController.ControlledMobs.Contains(this)) { - Log.SkipLine(); - Log.Inform("ERROR: SwitchController() failed to add mobObject: {0} to newController.ControlledMobs! \n Exception occured: {1}", this.ObjectID, e); - Log.SkipLine(); + try + { + newController.ControlledMobs.Add(this); + } + catch (Exception e) + { + Log.SkipLine(); + Log.Inform("ERROR: SwitchController() failed to add mobObject: {0} to newController.ControlledMobs! \n Exception occurred: {1}", this.ObjectID, e); + Log.SkipLine(); + } } } } @@ -307,8 +306,8 @@ public void Move(Packet iPacket) { oPacket .WriteInt(this.ObjectID) - .WriteShort(moveAction) - .WriteBool(cheatResult) + .WriteShort(moveAction) //moveActionID + .WriteBool(cheatResult) //UseSkills?? .WriteShort((short)this.Mana) .WriteByte(skillID) .WriteByte(skillLevel); @@ -321,7 +320,7 @@ public void Move(Packet iPacket) oPacket .WriteInt(this.ObjectID) .WriteBool(false) - .WriteBool(cheatResult) + .WriteBool(cheatResult) //UseSkills?? .WriteByte(centerSplit) .WriteInt(illegalVelocity) .WriteBytes(movements.ToByteArray()); @@ -367,6 +366,44 @@ public void Buff(MobStatus buff, short value, MobSkill skill) }, skill.Duration * 1000); } + public void Buff(MobStatus buff, short value, Skill skill) + { + using (Packet oPacket = new Packet(ServerOperationCode.MobStatSet)) + { + oPacket + .WriteInt(this.ObjectID) + .WriteLong() + .WriteInt() + .WriteInt((int)buff) + .WriteShort(value) + .WriteShort((short)skill.MapleID) + .WriteShort(skill.CurrentLevel) + .WriteShort(-1) + .WriteShort(0) // Delay + .WriteInt(); + + this.Map.Broadcast(oPacket); + } + + Delay.Execute(() => + { + using (Packet Packet = new Packet(ServerOperationCode.MobStatReset)) + { + Packet + .WriteInt(this.ObjectID) + .WriteLong() + .WriteInt() + .WriteInt((int)buff) + .WriteInt(); + + this.Map.Broadcast(Packet); + } + + this.Buffs.Remove(buff); + }, skill.BuffTime * 1000); + } + + public void Heal(uint hp, int range) { this.Health = Math.Min(this.MaxHealth, (uint)(this.Health + hp + Application.Random.Next(-range / 2, range / 2))); @@ -393,35 +430,51 @@ public void Die() } } + public bool IsAlive() + { + if (this.Health <= 0) + { + return false; + } + return true; + } + + public void ShowHpTo(Character player) + { + int hpRemaining = (int)(Math.Max(1, (this.Health * 100) / this.MaxHealth)); + + using (Packet oPacket = new Packet(ServerOperationCode.MobHPIndicator)) + { + oPacket + .WriteInt(this.ObjectID) + .WriteByte((byte)(hpRemaining)); + + player.Client.Send(oPacket); + } + } + public bool Damage(Character attacker, uint amount) { lock (this) { - uint originalAmount = amount; - amount = Math.Min(amount, this.Health); + //does the victim knows its attacker? if (this.Attackers.ContainsKey(attacker)) { + //if so then add to his established dmg bill this.Attackers[attacker] += amount; } else { + //if not so then add him as new attacker this.Attackers.Add(attacker, amount); } + + this.Health -= amount; //decrease health by amount dealt + ShowHpTo(attacker); //show monster's remaining hp bar to attacker - this.Health -= amount; - - using (Packet oPacket = new Packet(ServerOperationCode.MobHPIndicator)) - { - oPacket - .WriteInt(this.ObjectID) - .WriteByte((byte)((this.Health * 100) / this.MaxHealth)); - - attacker.Client.Send(oPacket); - } - - if (this.Health <= 0) + if (this.Health <= 0) //??? { return true; } @@ -463,8 +516,8 @@ private Packet GetInternalPacket(bool requestControl, bool newSpawn) .Skip(6) // NOTE: Unknown. .WriteShort(this.Position.X) .WriteShort(this.Position.Y) - .WriteByte((byte)(0x02 | (this.IsFacingLeft ? 0x01 : 0x00))) - .WriteShort(this.Foothold) + .WriteByte((byte)(0x02 | (this.IsFacingLeft ? 0x01 : 0x00))) // implement: getStance() + .WriteShort(this.Foothold) //foothold of origin MapObject.GetStartFH() .WriteShort(this.Foothold); if (this.SpawnEffect > 0) @@ -481,8 +534,8 @@ private Packet GetInternalPacket(bool requestControl, bool newSpawn) } oPacket - .WriteByte((byte)(newSpawn ? -2 : -1)) - .WriteByte() + .WriteByte((byte)(newSpawn ? -1 : -2)) //-2 : -1, seems wrong + .WriteByte() //?? .WriteByte(byte.MaxValue) // NOTE: Carnival team. .WriteInt(); // NOTE: Unknown. diff --git a/src/WvsGame/Maple/Life/MobSkill.cs b/src/WvsGame/Maple/Life/MobSkill.cs index b6bb058..2cd7212 100644 --- a/src/WvsGame/Maple/Life/MobSkill.cs +++ b/src/WvsGame/Maple/Life/MobSkill.cs @@ -3,6 +3,7 @@ using Destiny.Maple.Characters; using System; using System.Collections.Generic; +using Destiny.Constants; namespace Destiny.Maple.Life { @@ -53,7 +54,7 @@ public void Load(Datum datum) public void Cast(Mob caster) { MobStatus status = MobStatus.None; - CharacterDisease disease = CharacterDisease.None; + CharacterConstants.CharacterDisease disease = CharacterConstants.CharacterDisease.None; bool heal = false; //bool banish = false; bool dispel = false; @@ -89,31 +90,31 @@ public void Cast(Mob caster) break; case MobSkillName.Seal: - disease = CharacterDisease.Sealed; + disease = CharacterConstants.CharacterDisease.Sealed; break; case MobSkillName.Darkness: - disease = CharacterDisease.Darkness; + disease = CharacterConstants.CharacterDisease.Darkness; break; case MobSkillName.Weakness: - disease = CharacterDisease.Weaken; + disease = CharacterConstants.CharacterDisease.Weaken; break; case MobSkillName.Stun: - disease = CharacterDisease.Stun; + disease = CharacterConstants.CharacterDisease.Stun; break; case MobSkillName.Curse: - // TODO: Curse. + disease = CharacterConstants.CharacterDisease.Curse; break; case MobSkillName.Poison: - disease = CharacterDisease.Poison; + disease = CharacterConstants.CharacterDisease.Poison; break; case MobSkillName.Slow: - disease = CharacterDisease.Slow; + disease = CharacterConstants.CharacterDisease.Slow; break; case MobSkillName.Dispel: @@ -121,19 +122,19 @@ public void Cast(Mob caster) break; case MobSkillName.Seduce: - disease = CharacterDisease.Seduce; + disease = CharacterConstants.CharacterDisease.Seduce; break; case MobSkillName.SendToTown: // TODO: Send to town. break; - case MobSkillName.PoisonMist: + case MobSkillName.PoisonMist: // TODO: Spawn poison mist. break; case MobSkillName.Confuse: - disease = CharacterDisease.Confuse; + disease = CharacterConstants.CharacterDisease.Confuse; break; case MobSkillName.Zombify: @@ -202,7 +203,7 @@ public void Cast(Mob caster) } */ - if (disease != CharacterDisease.None) + if (disease != CharacterConstants.CharacterDisease.None) { using (Packet oPacket = new Packet(ServerOperationCode.TemporaryStatSet)) { diff --git a/src/WvsGame/Maple/Life/Npc.cs b/src/WvsGame/Maple/Life/Npc.cs index e53d3fc..b7cd064 100644 --- a/src/WvsGame/Maple/Life/Npc.cs +++ b/src/WvsGame/Maple/Life/Npc.cs @@ -85,6 +85,7 @@ public void Handle(Character talker, Packet iPacket) } NpcMessageType lastMessageType = (NpcMessageType)iPacket.ReadByte(); + byte action = iPacket.ReadByte(); // TODO: Validate last message type. diff --git a/src/WvsGame/Maple/Life/SpawnPoint.cs b/src/WvsGame/Maple/Life/SpawnPoint.cs index 7a42cbd..8d4a667 100644 --- a/src/WvsGame/Maple/Life/SpawnPoint.cs +++ b/src/WvsGame/Maple/Life/SpawnPoint.cs @@ -1,4 +1,6 @@ -using Destiny.Data; +using System; +using Destiny.Data; +using Destiny.IO; namespace Destiny.Maple.Life { @@ -16,7 +18,16 @@ public void Spawn() { if (this.IsMob) { - this.Map.Mobs.Add(new Mob(this)); + try + { + this.Map.Mobs.Add(new Mob(this)); + } + catch (Exception e) + { + Log.SkipLine(); + Log.Inform("SpawnPoint-Spawn() exception occurred: {0}", e); + Log.SkipLine(); + } } else { diff --git a/src/WvsGame/Maple/Maps/Drop.cs b/src/WvsGame/Maple/Maps/Drop.cs index 023caec..468150b 100644 --- a/src/WvsGame/Maple/Maps/Drop.cs +++ b/src/WvsGame/Maple/Maps/Drop.cs @@ -107,4 +107,4 @@ public Packet GetDestroyPacket() return oPacket; } } -} +} \ No newline at end of file diff --git a/src/WvsGame/Maple/Maps/MapDrops.cs b/src/WvsGame/Maple/Maps/MapDrops.cs index 5b435e3..6a578cd 100644 --- a/src/WvsGame/Maple/Maps/MapDrops.cs +++ b/src/WvsGame/Maple/Maps/MapDrops.cs @@ -1,4 +1,6 @@ -using Destiny.Maple.Characters; +using System; +using Destiny.IO; +using Destiny.Maple.Characters; using Destiny.Network; using Destiny.Threading; @@ -53,7 +55,20 @@ protected override void RemoveItem(int index) this.Map.Broadcast(oPacket); } - base.RemoveItem(index); + if (base.Items.Count > index) + { + try + { + base.RemoveItem(index); + } + catch (Exception e) + { + Log.SkipLine(); + Log.Inform("MapDrops-RemoveItem: exception occurred: {0}", e); + Log.SkipLine(); + } + } + } } -} +} \ No newline at end of file diff --git a/src/WvsGame/Maple/Maps/MapMobs.cs b/src/WvsGame/Maple/Maps/MapMobs.cs index fb0e14c..0b9bb06 100644 --- a/src/WvsGame/Maple/Maps/MapMobs.cs +++ b/src/WvsGame/Maple/Maps/MapMobs.cs @@ -31,7 +31,7 @@ protected override void InsertItem(int index, Mob item) catch (Exception e) { Log.SkipLine(); - Log.Inform("ERROR: MapMobs-InsertItem() failed to AssignController to mobObject item: {0}! \n Exception occured: {1}", item.ObjectID, e); + Log.Inform("ERROR: MapMobs-InsertItem() failed to AssignController to mobObject item: {0}! \n Exception occurred: {1}", item.ObjectID, e); Log.SkipLine(); } } @@ -151,7 +151,7 @@ protected override void RemoveItem(int index) // NOTE: Equivalent of mob death. catch (Exception e) { Log.SkipLine(); - Log.Inform("ERROR: failed to remove mobObject: {0} from controlledMobs! \n Exception occured: {1}", item.ObjectID, e); + Log.Inform("ERROR: failed to remove mobObject: {0} from controlledMobs! \n Exception occurred: {1}", item.ObjectID, e); Log.SkipLine(); } } diff --git a/src/WvsGame/Maple/Maps/MapObjectMist.cs b/src/WvsGame/Maple/Maps/MapObjectMist.cs new file mode 100644 index 0000000..bf33942 --- /dev/null +++ b/src/WvsGame/Maple/Maps/MapObjectMist.cs @@ -0,0 +1,25 @@ +using Destiny.Maple.Data; +using Destiny.Maple.Life; +using Destiny.Network; + +namespace Destiny.Maple.Maps +{ + public sealed class MapObjectMist : MapObjects + { + public MapObjectMist(Map map) : base(map) { } + + protected override void InsertItem(int index, Mist item) + { + base.InsertItem(index, item); + + if (DataProvider.IsInitialized) + { + using (Packet oPacket = item.GetCreatePacket()) + { + this.Map.Broadcast(oPacket); + } + } + } + + } +} \ No newline at end of file diff --git a/src/WvsGame/Maple/Maps/MapObjects.cs b/src/WvsGame/Maple/Maps/MapObjects.cs index 7e810dd..4ff89d0 100644 --- a/src/WvsGame/Maple/Maps/MapObjects.cs +++ b/src/WvsGame/Maple/Maps/MapObjects.cs @@ -47,7 +47,7 @@ protected override void InsertItem(int index, T item) catch(Exception e) { Log.SkipLine(); - Log.Inform("ERROR: MapObjects-InsertItem() failed to insert item! Index: {0} \n Exception occured: {1}", index, e); + Log.Inform("ERROR: MapObjects-InsertItem() failed to insert item! Index: {0} \n Exception occurred: {1}", index, e); Log.SkipLine(); } @@ -62,27 +62,35 @@ protected override void RemoveItem(int index) Log.SkipLine(); Log.Inform("ERROR: MapObjects-RemoveItem() failed to remove item! Index: {0} \n Theres less items then index points to: {1}", index, base.Items.Count); Log.SkipLine(); - return; } - T item = base.Items[index]; - item.Map = null; - - if (!(item is Character) && !(item is Portal)) + else if (base.Items.Count >= index) { - item.ObjectID = -1; - } + T item = base.Items[index]; + item.Map = null; - try - { - base.RemoveItem(index); + if (!(item is Character) && !(item is Portal)) + { + item.ObjectID = -1; + } + + try + { + base.RemoveItem(index); + } + catch (Exception e) + { + Log.SkipLine(); + Log.Inform("ERROR: MapObjects-RemoveItem() failed to remove item! Index: {0} \n Exception occurred: {1}", index, e); + Log.SkipLine(); + } } - catch(Exception e) + else { Log.SkipLine(); - Log.Inform("ERROR: MapObjects-RemoveItem() failed to remove item! Index: {0} \n Exception occured: {1}", index, e); + Log.Inform("ERROR: MapObjects-RemoveItem() failed to remove item! ItemIndex: {0}, Items.Count: {1}", index, Items.Count); Log.SkipLine(); - } + } } else { diff --git a/src/WvsGame/Maple/Maps/Portal.cs b/src/WvsGame/Maple/Maps/Portal.cs index a374f75..4ec3634 100644 --- a/src/WvsGame/Maple/Maps/Portal.cs +++ b/src/WvsGame/Maple/Maps/Portal.cs @@ -1,4 +1,5 @@ -using Destiny.Data; +using Destiny.Constants; +using Destiny.Data; using Destiny.Network; using Destiny.Maple.Characters; using Destiny.Maple.Data; @@ -62,7 +63,7 @@ public void Enter(Character character) public void PlaySoundEffect(Character character) { - character.ShowLocalUserEffect(UserEffect.PlayPortalSE); + character.ShowLocalUserEffect(CharacterConstants.UserEffect.PlayPortalSE); } public void ShowBalloonMessage(Character character, string text, short width, short height) @@ -84,7 +85,7 @@ public void ShowTutorialMessage(Character character, string dataPath) using (Packet oPacket = new Packet(ServerOperationCode.Effect)) { oPacket - .WriteByte((byte)UserEffect.AvatarOriented) + .WriteByte((byte)CharacterConstants.UserEffect.AvatarOriented) .WriteString(dataPath) .WriteInt(1); diff --git a/src/WvsGame/Maple/Quest.cs b/src/WvsGame/Maple/Quest.cs index e3b5998..7c20f11 100644 --- a/src/WvsGame/Maple/Quest.cs +++ b/src/WvsGame/Maple/Quest.cs @@ -1,6 +1,7 @@ using Destiny.Data; using Destiny.Maple.Data; using System.Collections.Generic; +using Destiny.Constants; namespace Destiny.Maple { @@ -24,7 +25,7 @@ public class Quest public Dictionary PreRequiredItems { get; private set; } public Dictionary PostRequiredItems { get; private set; } public Dictionary PostRequiredKills { get; private set; } - public List ValidJobs { get; private set; } + public List ValidJobs { get; private set; } // Rewards (Start, End) public int[] ExperienceReward { get; set; } @@ -35,8 +36,8 @@ public class Quest public int[] PetSkillReward { get; set; } public Dictionary PreItemRewards { get; private set; } public Dictionary PostItemRewards { get; private set; } - public Dictionary PreSkillRewards { get; set; } - public Dictionary PostSkillRewards { get; set; } + public Dictionary PreSkillRewards { get; set; } + public Dictionary PostSkillRewards { get; set; } public Quest NextQuest { @@ -89,10 +90,10 @@ public Quest(Datum datum) this.PreItemRewards = new Dictionary(); this.PostItemRewards = new Dictionary(); - this.PreSkillRewards = new Dictionary(); - this.PostSkillRewards = new Dictionary(); + this.PreSkillRewards = new Dictionary(); + this.PostSkillRewards = new Dictionary(); - this.ValidJobs = new List(); + this.ValidJobs = new List(); } } } diff --git a/src/WvsGame/Maple/Rectangle.cs b/src/WvsGame/Maple/Rectangle.cs index c77e634..53a7e71 100644 --- a/src/WvsGame/Maple/Rectangle.cs +++ b/src/WvsGame/Maple/Rectangle.cs @@ -10,5 +10,12 @@ public Rectangle(Point lt, Point rb) this.LT = lt; this.RB = rb; } + + /*public override Rectangle( + int x, + int y, + int width, + int height + )*/ } } diff --git a/src/WvsGame/Maple/Scripting/PortalScript.cs b/src/WvsGame/Maple/Scripting/PortalScript.cs index 090c2ad..9798401 100644 --- a/src/WvsGame/Maple/Scripting/PortalScript.cs +++ b/src/WvsGame/Maple/Scripting/PortalScript.cs @@ -1,6 +1,7 @@ using Destiny.Maple.Characters; using Destiny.Maple.Maps; using System; +using Destiny.Constants; namespace Destiny.Maple.Scripting { @@ -18,7 +19,7 @@ public PortalScript(Portal portal, Character character) private void PlayPortalSoundEffect() { - mCharacter.ShowLocalUserEffect(UserEffect.PlayPortalSE); + mCharacter.ShowLocalUserEffect(CharacterConstants.UserEffect.PlayPortalSE); } } } diff --git a/src/WvsGame/Maple/Skill.cs b/src/WvsGame/Maple/Skill.cs index 1e4bdf2..091b117 100644 --- a/src/WvsGame/Maple/Skill.cs +++ b/src/WvsGame/Maple/Skill.cs @@ -3,7 +3,10 @@ using Destiny.Maple.Characters; using Destiny.Maple.Data; using System; +using System.Linq; +using Destiny.Constants; using Destiny.IO; +using Destiny.Maple.Life; using Destiny.Threading; namespace Destiny.Maple @@ -380,6 +383,27 @@ public void Cast() { this.CooldownEnd = DateTime.Now.AddSeconds(this.Cooldown); } + + if (this.MapleID == (int)CharacterConstants.SkillNames.FirePoisonMage.PoisonMist) + { + Point mistMaxLT = new Point(-200, -150); + Point mistMaxRB = new Point(200, 150); + + Rectangle boundingBox = new Rectangle(mistMaxLT + this.Character.Position, mistMaxRB + this.Character.Position); + + Mist poisonMist = new Mist(boundingBox, this.Character, this); + //Mist.SpawnMist(this.Character.Client, poisonMist); + //get damage ticks of poisoned mobs within bounds + } + + if (this.MapleID == (int) CharacterConstants.SkillNames.FirePoisonWizard.PoisonBreath) + { + Mob victim = this.Character.ControlledMobs.FirstOrDefault(); + if (victim != null) + { + victim.Buff(MobStatus.Poisoned, 1, this); + } + } } //public void Cast(Packet iPacket) diff --git a/src/WvsGame/Network/GameClient.cs b/src/WvsGame/Network/GameClient.cs index a22404a..6fe8aee 100644 --- a/src/WvsGame/Network/GameClient.cs +++ b/src/WvsGame/Network/GameClient.cs @@ -1,6 +1,7 @@ using Destiny.Maple; using Destiny.Maple.Characters; using System.Net.Sockets; +using Destiny.Constants; namespace Destiny.Network { @@ -93,15 +94,15 @@ protected override void Dispatch(Packet iPacket) break; case ClientOperationCode.CloseRangeAttack: - this.Character.Attack(iPacket, AttackType.Melee); + this.Character.Attack(iPacket, CharacterConstants.AttackType.Melee); break; case ClientOperationCode.RangedAttack: - this.Character.Attack(iPacket, AttackType.Range); + this.Character.Attack(iPacket, CharacterConstants.AttackType.Range); break; case ClientOperationCode.MagicAttack: - this.Character.Attack(iPacket, AttackType.Magic); + this.Character.Attack(iPacket, CharacterConstants.AttackType.Magic); break; case ClientOperationCode.TakeDamage: diff --git a/src/WvsGame/WvsGame.csproj b/src/WvsGame/WvsGame.csproj index 8895bac..eff0ff7 100644 --- a/src/WvsGame/WvsGame.csproj +++ b/src/WvsGame/WvsGame.csproj @@ -88,6 +88,7 @@ + @@ -112,6 +113,7 @@ + @@ -129,6 +131,7 @@ + diff --git a/src/WvsLogin/Maple/Account.cs b/src/WvsLogin/Maple/Account.cs index 6134948..e4962d9 100644 --- a/src/WvsLogin/Maple/Account.cs +++ b/src/WvsLogin/Maple/Account.cs @@ -3,6 +3,7 @@ using Destiny.Network; using System; using System.Data; +using Destiny.Constants; namespace Destiny.Maple { @@ -15,7 +16,7 @@ public sealed class Account public string Password { get; set; } public string Salt { get; set; } public bool EULA { get; set; } - public Gender Gender { get; set; } + public CharacterConstants.Gender Gender { get; set; } public string Pin { get; set; } public string Pic { get; set; } public bool IsBanned { get; set; } @@ -51,7 +52,7 @@ public void Load(string username) this.Password = (string)datum["Password"]; this.Salt = (string)datum["Salt"]; this.EULA = (bool)datum["EULA"]; - this.Gender = (Gender)datum["Gender"]; + this.Gender = (CharacterConstants.Gender)datum["Gender"]; this.Pin = (string)datum["Pin"]; this.Pic = (string)datum["Pic"]; this.IsBanned = (bool)datum["IsBanned"]; diff --git a/src/WvsLogin/Maple/World.cs b/src/WvsLogin/Maple/World.cs index e1f7a85..8f1f9dc 100644 --- a/src/WvsLogin/Maple/World.cs +++ b/src/WvsLogin/Maple/World.cs @@ -85,7 +85,7 @@ protected override void InsertItem(int index, Channel item) base.InsertItem(index, item); Log.SkipLine(); - Log.Success("Registered Channel {0}-{1}.", this.Name, item.ID); + Log.Success("Registered Channel ({0}-{1}).", this.Name, item.ID + 1); Log.SkipLine(); } diff --git a/src/WvsLogin/Network/LoginClient.cs b/src/WvsLogin/Network/LoginClient.cs index 33dce71..83d6458 100644 --- a/src/WvsLogin/Network/LoginClient.cs +++ b/src/WvsLogin/Network/LoginClient.cs @@ -4,6 +4,7 @@ using System; using System.Collections.Generic; using System.Net.Sockets; +using Destiny.Constants; namespace Destiny.Network { @@ -147,7 +148,7 @@ private void Login(Packet iPacket) this.Account.Salt = HashGenerator.GenerateMD5(); this.Account.Password = SHACryptograph.Encrypt(SHAMode.SHA512, password + this.Account.Salt); this.Account.EULA = false; - this.Account.Gender = Gender.Unset; + this.Account.Gender = CharacterConstants.Gender.Unset; this.Account.Pin = string.Empty; this.Account.Pic = string.Empty; this.Account.IsBanned = false; @@ -226,7 +227,7 @@ private void EULA(Packet iPacket) private void SetGender(Packet iPacket) { - if (this.Account.Gender != Gender.Unset) + if (this.Account.Gender != CharacterConstants.Gender.Unset) { return; } @@ -235,7 +236,7 @@ private void SetGender(Packet iPacket) if (valid) { - Gender gender = (Gender)iPacket.ReadByte(); + CharacterConstants.Gender gender = (CharacterConstants.Gender)iPacket.ReadByte(); this.Account.Gender = gender;