public Dictionary <byte, UInt16> ApplyLevel() { Dictionary <byte, UInt16> Diff = new Dictionary <byte, ushort>(); CharacterInfo_stats[] NewStats = CharMgr.GetCharacterInfoStats(_Info.CareerLine, _Value.Level); if (NewStats == null || NewStats.Length <= 0) { return(Diff); } foreach (CharacterInfo_stats Stat in NewStats) { UInt16 Base = StsInterface.GetBaseStat(Stat.StatId); if (Stat.StatValue > Base) { Diff.Add(Stat.StatId, (ushort)(Stat.StatValue - Base)); } StsInterface.SetBaseStat(Stat.StatId, Stat.StatValue); } StsInterface.ApplyStats(); return(Diff); }
public override void OnLoad() { _Client.State = (int)eClientState.WorldEnter; if (!_Inited) { EvtInterface.Obj = this; EvtInterface.AddEventNotify("Playing", Save); EvtInterface.Start(); ItmInterface.Load(CharMgr.GetItemChar(_Info.CharacterId)); StsInterface.Load(CharMgr.GetCharacterInfoStats(_Info.CareerLine, _Value.Level)); QtsInterface.Load(this._Info.Quests); TokInterface.Load(_Info.Toks); SocInterface.Load(_Info.Socials); AbtInterface.Load(); StsInterface.ApplyStats(); SetLevel(_Value.Level); SetRenownLevel(_Value.RenownRank); SetOffset((UInt16)(_Value.WorldX >> 12), (UInt16)(_Value.WorldY >> 12)); _Inited = true; } base.OnLoad(); StartInit(); }
protected override void SetCreatureStats() { Speed = 320; StsInterface.Speed = 320; MvtInterface.SetBaseSpeed(Speed); // Normal siege weapons will tank 5 cannon hits (4500, cannons hit for 1000) // Rams will tank 300 cannon hits (60000, cannons hit for 200) switch (Keep.Tier) { case 2: StsInterface.SetBaseStat(Stats.Wounds, _type == SiegeType.RAM ? (ushort)3500 : (ushort)500); break; case 3: StsInterface.SetBaseStat(Stats.Wounds, _type == SiegeType.RAM ? (ushort)4600 : (ushort)700); break; case 4: StsInterface.SetBaseStat(Stats.Wounds, _type == SiegeType.RAM ? (ushort)6000 : (ushort)900); break; } StsInterface.ApplyStats(); }
public void SendStats() { PacketOut Out = new PacketOut((byte)Opcodes.F_PLAYER_STATS); ItmInterface.BuildStats(ref Out); StsInterface.BuildStats(ref Out); SendPacket(Out); }
protected override void SetCreatureStats() { Speed = 320; StsInterface.Speed = 320; MvtInterface.SetBaseSpeed(Speed); // Normal siege weapons will tank 5 cannon hits (4500, cannons hit for 1000) // Rams will tank 300 cannon hits (60000, cannons hit for 200) StsInterface.SetBaseStat(Stats.Wounds, _type == SiegeType.RAM ? (ushort)6000 : (ushort)900); StsInterface.ApplyStats(); }
public override void Dispose() { ItmInterface.Stop(); CbtInterface.Stop(); StsInterface.Stop(); QtsInterface.Stop(); MvtInterface.Stop(); AbtInterface.Stop(); EvtInterface.Stop(); AiInterface.Stop(); base.Dispose(); }
public virtual bool OnLeaveCombat(Object mob, object args) { // save statistics InstanceService.SaveDeathCountPerBoss(Instance.ZoneID + ":" + Instance.ID, mob.GetInstanceBossSpawn(), PlayerDeathsCount); if (!mob.GetInstanceBossSpawn().IsDead) { // save statistics InstanceService.SaveAttemptsPerBoss(Instance.ZoneID + ":" + Instance.ID, this, 1); if (InstanceGroupSpawnId > 0) { Instance.BossRespawnInstanceGroup(InstanceGroupSpawnId); } } else { PlayerDeathsCount = 0; // save statistics InstanceService.SaveTtkPerBoss(Instance.ZoneID + ":" + Instance.ID, this, BossTimer.Elapsed); } // Want to keep the add list on the boss instance. //// reset add list //AddDictionary = new List<Creature>(); // reset all Modify Scalers ModifyDmgHealScaler = 1f; List <Player> plrs = GetPlayersInRange(300, false); foreach (Player plr in plrs) { plr.ModifyDmgHealScaler = 1f; } // reset the outgoing damage of the boss try { StsInterface.RemoveBonusMultiplier(GameData.Stats.OutgoingDamagePercent, 1.0f, BuffClass.Standard); } catch (Exception e) { Log.Error("Exception", e.Message + "\r\n" + e.StackTrace); } if (BossTimer != null) { BossTimer.Reset(); } return(false); }
public override void Update() { long Tick = TCPManager.GetTimeStampMS(); UpdateHealth(Tick); UpdateActionPoints(Tick); EvtInterface.Update(Tick); CbtInterface.Update(Tick); ItmInterface.Update(Tick); StsInterface.Update(Tick); QtsInterface.Update(Tick); MvtInterface.Update(Tick); AbtInterface.Update(Tick); AiInterface.Update(Tick); if (NextSend < Tick) { NextSend = Tick + STATE_INTERVAL; SendState(null); } base.Update(); }
public override void OnLoad() { InteractType = GenerateInteractType(Spawn.Title); SetFaction(Spawn.Faction != 0 ? Spawn.Faction : Spawn.Proto.Faction); ItmInterface.Load(WorldMgr.GetCreatureItems(Spawn.Entry)); Level = (byte)RandomMgr.Next((int)Spawn.Proto.MinLevel, (int)Spawn.Proto.MaxLevel); StsInterface.SetBaseStat((byte)GameData.Stats.STATS_WOUNDS, GenerateWounds(Level, Rank)); StsInterface.ApplyStats(); Health = TotalHealth; X = Zone.CalculPin((uint)(Spawn.WorldX), true); Y = Zone.CalculPin((uint)(Spawn.WorldY), false); Z = (ushort)(Spawn.WorldZ * 2); // TODO : Bad Height Formula /*int HeightMap = HeightMapMgr.GetHeight(Zone.ZoneId, X, Y); * if (Z < HeightMap) * { * Log.Error("Creature", "["+Spawn.Entry+"] Invalid Height : Min=" + HeightMap + ",Z=" + Z); * return; * }*/ Heading = (ushort)Spawn.WorldO; WorldPosition.X = Spawn.WorldX; WorldPosition.Y = Spawn.WorldY; WorldPosition.Z = Spawn.WorldZ; SetOffset((ushort)(Spawn.WorldX >> 12), (ushort)(Spawn.WorldY >> 12)); Region.UpdateRange(this); base.OnLoad(); }
protected override void SetCreatureStats() { if (Owner.Info.CareerLine == (int)CareerLine.CAREERLINE_MAGUS) { StsInterface.Load(CharMgr.GetCharacterInfoStats((byte)CareerLine.CAREERLINE_MAGUS, Math.Min(Level, (byte)40))); } float armorMod = 1.0f, resistMod = 1.0f, woundsMod = 1f, itemWoundsMod = 0f; switch (Spawn.Proto.Model1) { // White Lion // War Lions case 132: case 133: case 134: case 135: StsInterface.Load(CharMgr.GetCharacterInfoStats((byte)CareerLine.CAREERLINE_WAR_LION, Math.Min(Level, (byte)40))); woundsMod = 1f; itemWoundsMod = 1f; _weaponDamageContribution = WeaponDamageContribution.MainHand; break; // Beastmaster case 1156: // War Manticore case 1086: // Harpy case 1142: // Giant Scorpion case 1272: // Hydra StsInterface.Load(CharMgr.GetCharacterInfoStats((byte)CareerLine.CAREERLINE_WAR_MANTICORE, Math.Min(Level, (byte)40))); woundsMod = 1f; itemWoundsMod = 1f; _weaponDamageContribution = WeaponDamageContribution.MainHand; break; // Squig case 136: StsInterface.Load(CharMgr.GetCharacterInfoStats((byte)CareerLine.CAREERLINE_SQUIG, Math.Min(Level, (byte)40))); armorMod = 2.0f; woundsMod = 1f; itemWoundsMod = 0.5f; _weaponDamageContribution = WeaponDamageContribution.MainHand; break; // Horned Squig case 137: StsInterface.Load(CharMgr.GetCharacterInfoStats((byte)CareerLine.CAREERLINE_HORNED_SQUIG, Math.Min(Level, (byte)40))); armorMod = 2.0f; resistMod = 0.5f; woundsMod = 1f; itemWoundsMod = 1f; _weaponDamageContribution = WeaponDamageContribution.MainAndRanged; break; // Spiked Squig case 138: StsInterface.Load(CharMgr.GetCharacterInfoStats((byte)CareerLine.CAREERLINE_SPIKED_SQUIG, Math.Min(Level, (byte)40))); woundsMod = 0.85f; itemWoundsMod = 0.85f; _weaponDamageContribution = WeaponDamageContribution.Ranged; _ignoreZ = true; break; // Gas Squig case 139: StsInterface.Load(CharMgr.GetCharacterInfoStats((byte)CareerLine.CAREERLINE_GAS_SQUIG, Math.Min(Level, (byte)40))); woundsMod = 0.65f; itemWoundsMod = 0.65f; _weaponDamageContribution = WeaponDamageContribution.Ranged; _ignoreZ = true; break; // Magus // Pink Horror case 141: woundsMod = 0.5f; _weaponDamageContribution = WeaponDamageContribution.MainHand; _weaponDamageFactor = 0.7f; break; // Blue Horror case 142: armorMod = 2f; woundsMod = 1f; _weaponDamageContribution = WeaponDamageContribution.MainHand; _weaponDamageFactor = 0.85f; break; // Flamer case 143: armorMod = 1.5f; woundsMod = 0.75f; _weaponDamageContribution = WeaponDamageContribution.MainHand; break; // Engineer // Gun Turret case 145: woundsMod = 0.5f; _weaponDamageContribution = WeaponDamageContribution.MainAndRanged; _weaponDamageFactor = 0.7f; break; // Bombardment Turret case 146: armorMod = 1.5f; woundsMod = 0.75f; _weaponDamageContribution = WeaponDamageContribution.MainAndRanged; _weaponDamageFactor = 0.85f; break; // Flame Turret case 147: armorMod = 2f; woundsMod = 1f; _weaponDamageContribution = WeaponDamageContribution.MainAndRanged; break; // This is to handle .setpet command, it sets the stats of Lion / Manticore default: StsInterface.Load(CharMgr.GetCharacterInfoStats((byte)CareerLine.CAREERLINE_WAR_MANTICORE, Math.Min(Level, (byte)40))); woundsMod = 1f; itemWoundsMod = 1f; _weaponDamageContribution = WeaponDamageContribution.MainHand; break; } StsInterface.SetBaseStat(Stats.Wounds, (ushort)(Owner.StsInterface.GetCoreStat(Stats.Wounds) * woundsMod)); StsInterface.AddItemBonusStat(Stats.Willpower, Owner.StsInterface.GetItemStat(Stats.Willpower)); if (itemWoundsMod > 0f) { StsInterface.AddItemBonusStat(Stats.Wounds, (ushort)(Owner.StsInterface.GetItemStat(Stats.Wounds) * itemWoundsMod)); } StsInterface.AddItemBonusStat(Stats.Initiative, Owner.StsInterface.GetItemStat(Stats.Initiative)); StsInterface.AddItemBonusStat(Stats.Armor, (ushort)(Owner.StsInterface.GetItemStat(Stats.Armor) * armorMod)); StsInterface.AddItemBonusStat(Stats.SpiritResistance, (ushort)(Owner.StsInterface.GetItemStat(Stats.SpiritResistance) * resistMod)); StsInterface.AddItemBonusStat(Stats.ElementalResistance, (ushort)(Owner.StsInterface.GetItemStat(Stats.ElementalResistance) * resistMod)); StsInterface.AddItemBonusStat(Stats.CorporealResistance, (ushort)(Owner.StsInterface.GetItemStat(Stats.CorporealResistance) * resistMod)); StsInterface.ApplyStats(); }
public override void OnLoad() { InteractType = GenerateInteractType(Spawn.Title != 0 ? Spawn.Title : Spawn.Proto.Title); SetFaction(Spawn.Faction != 0 ? Spawn.Faction : Spawn.Proto.Faction); ItmInterface.Load(WorldMgr.GetCreatureItems(Spawn.Entry)); if (Spawn.Proto.MinLevel > Spawn.Proto.MaxLevel) { Spawn.Proto.MinLevel = Spawn.Proto.MaxLevel; } if (Spawn.Proto.MaxLevel <= Spawn.Proto.MinLevel) { Spawn.Proto.MaxLevel = Spawn.Proto.MinLevel; } if (Spawn.Proto.MaxLevel == 0) { Spawn.Proto.MaxLevel = 1; } if (Spawn.Proto.MinLevel == 0) { Spawn.Proto.MinLevel = 1; } Level = (byte)RandomMgr.Next((int)Spawn.Proto.MinLevel, (int)Spawn.Proto.MaxLevel + 1); StsInterface.SetBaseStat((byte)GameData.Stats.STATS_WOUNDS, GenerateWounds(Level, Rank)); StsInterface.ApplyStats(); Health = TotalHealth; X = Zone.CalculPin((uint)(Spawn.WorldX), true); Y = Zone.CalculPin((uint)(Spawn.WorldY), false); Z = (ushort)(Spawn.WorldZ); /* * if (Zone.ZoneId == 161) * { * Z += 16384; * X += 16384; * Y += 16384; * } */ // TODO : Bad Height Formula /*int HeightMap = HeightMapMgr.GetHeight(Zone.ZoneId, X, Y); * if (Z < HeightMap) * { * Log.Error("Creature", "["+Spawn.Entry+"] Invalid Height : Min=" + HeightMap + ",Z=" + Z); * return; * }*/ Heading = (ushort)Spawn.WorldO; WorldPosition.X = Spawn.WorldX; WorldPosition.Y = Spawn.WorldY; WorldPosition.Z = Spawn.WorldZ; SetOffset((ushort)(Spawn.WorldX >> 12), (ushort)(Spawn.WorldY >> 12)); ScrInterface.AddScript(Spawn.Proto.ScriptName); base.OnLoad(); if (Spawn.Title == 0 && Spawn.Icone == 0 && Spawn.Proto.Title == 0 && Spawn.Icone == 0 && Spawn.Emote == 0 && Spawn.Proto.FinishingQuests == null && Spawn.Proto.StartingQuests == null) { if (Faction <= 1 || Faction == 128 || Faction == 129) { SFastRandom Random = new SFastRandom(X ^ Y ^ Z); for (int i = 0; i < 3; ++i) { Waypoint Wp = new Waypoint(); Wp.X = (ushort)(X + Random.randomInt(50) + Random.randomInt(100) + Random.randomInt(150)); Wp.Y = (ushort)(Y + Random.randomInt(50) + Random.randomInt(100) + Random.randomInt(150)); Wp.Z = (ushort)Z; Wp.Speed = 10; Wp.WaitAtEndMS = (uint)(5000 + Random.randomIntAbs(10) * 1000); AiInterface.AddWaypoint(Wp); } } } IsActive = true; }
public override void OnLoad() { InteractType = GenerateInteractType(Spawn.Title != 0 ? Spawn.Title : Spawn.Proto.Title); SetFaction(Spawn.Faction != 0 ? Spawn.Faction : Spawn.Proto.Faction); ItmInterface.Load(WorldMgr.GetCreatureItems(Spawn.Entry)); if (Spawn.Proto.MinLevel > Spawn.Proto.MaxLevel) { Spawn.Proto.MinLevel = Spawn.Proto.MaxLevel; } if (Spawn.Proto.MaxLevel <= Spawn.Proto.MinLevel) { Spawn.Proto.MaxLevel = Spawn.Proto.MinLevel; } if (Spawn.Proto.MaxLevel == 0) { Spawn.Proto.MaxLevel = 1; } if (Spawn.Proto.MinLevel == 0) { Spawn.Proto.MinLevel = 1; } if (Spawn.Level != 0) { if (Spawn.Level > 2) { Level = (byte)RandomMgr.Next((int)Spawn.Level - 1, Spawn.Level + 1); } else { Level = (byte)RandomMgr.Next((int)Spawn.Level, Spawn.Level + 1); } } else { Level = (byte)RandomMgr.Next((int)Spawn.Proto.MinLevel, (int)Spawn.Proto.MaxLevel + 1); } StsInterface.SetBaseStat((byte)GameData.Stats.STATS_WOUNDS, GenerateWounds(Level, Rank)); StsInterface.ApplyStats(); Health = TotalHealth; X = Zone.CalculPin((uint)(Spawn.WorldX), true); Y = Zone.CalculPin((uint)(Spawn.WorldY), false); Z = (ushort)(Spawn.WorldZ); /* * if (Zone.ZoneId == 161) * { * Z += 16384; * X += 16384; * Y += 16384; * } * //*/ // TODO : Bad Height Formula /* * //int HeightMap = HeightMapMgr.GetHeight(Zone.ZoneId, X, Y); * int HeightMap = ClientFileMgr.GetHeight(Zone.ZoneId, X, Y); * * if (Z < HeightMap) * { * Log.Error("Creature", "["+Spawn.Entry+"] Invalid Height : Min=" + HeightMap + ",Z=" + Z); * return; * }*/ Heading = (ushort)Spawn.WorldO; WorldPosition.X = Spawn.WorldX; WorldPosition.Y = Spawn.WorldY; WorldPosition.Z = Spawn.WorldZ; SetOffset((ushort)(Spawn.WorldX >> 12), (ushort)(Spawn.WorldY >> 12)); ScrInterface.AddScript(Spawn.Proto.ScriptName); base.OnLoad(); /*AiInterface.Waypoints = WorldMgr.GetNpcWaypoints(Spawn.Guid); * * if (Spawn.Title == 0 && Spawn.Icone == 0 && Spawn.Proto.Title == 0 && Spawn.Icone == 0 && Spawn.Emote == 0 && Spawn.Proto.FinishingQuests == null && Spawn.Proto.StartingQuests == null) * { * if (Faction <= 1 || Faction == 128 || Faction == 129) * { * if (AiInterface.Waypoints.Count <= 4) * { * int i = 0; * if (AiInterface.Waypoints.Count != 0) * i = AiInterface.Waypoints.Count - 1; * for (; i < 3; ++i) * { * AiInterface.AddWaypoint(new Waypoint()); * } * } * foreach (Waypoint Wp in AiInterface.Waypoints) * { * AiInterface.RandomizeWaypoint(Wp); * } * } * }*/ IsActive = true; if (InteractType == GameData.InteractType.INTERACTTYPE_TRAINER) { States.Add(1); } if (InteractType == GameData.InteractType.INTERACTTYPE_BANKER) { States.Add(11); // 11 } if (InteractType == GameData.InteractType.INTERACTTYPE_GUILD_VAULT) // added { States.Add(0); // dont know what states are yet ? } if (InteractType == GameData.InteractType.INTERACTTYPE_AUCTIONEER) { States.Add(12); } if (InteractType == GameData.InteractType.INTERACTTYPE_GUILD_REGISTRAR) { States.Add(14); } if (InteractType == GameData.InteractType.INTERACTTYPE_FLIGHT_MASTER) { States.Add(15); } if (InteractType == GameData.InteractType.INTERACTTYPE_DYEMERCHANT) { States.Add(26); } }