public static void ShowWeather(Entities.GameClient client) { try { using (var weather = new Packets.WeatherPacket()) { weather.Weather = client.Map.Weather; weather.Intensity = client.Map.WeatherIntensity; weather.Appearance = client.Map.WeatherAppearance; weather.Direction = client.Map.WeatherDirection; client.Send(weather); } if (client.Map.Weather == Enums.Weather.Rain) { Packets.GeneralDataPacket general = new ProjectX_V3_Game.Packets.GeneralDataPacket(Enums.DataAction.MapARGB); general.Id = client.EntityUID; general.Data1 = 5855577; client.Send(general); } else { Packets.GeneralDataPacket general = new ProjectX_V3_Game.Packets.GeneralDataPacket(Enums.DataAction.MapARGB); general.Id = client.EntityUID; general.Data1 = 0; client.Send(general); } } catch { } }
/// <summary> /// Handling the Use action from the ItemPacket. /// </summary> /// <param name="client">The client.</param> /// <param name="item">The item packet.</param> public static void Handle(Entities.GameClient client, ItemPacket packet) { uint uid = packet.UID; if (client.Inventory.ContainsByUID(uid)) { Data.ItemInfo useitem = client.Inventory[uid]; if (useitem.IsMisc()) { if (!Core.Kernel.ItemScriptEngine.Invoke(useitem.ItemID, new object[] { client, useitem })) { using (var fmsg = Packets.Message.MessageCore.CreateSystem(client.Name, string.Format(Core.MessageConst.INVALD_ITEM_USE, useitem.Name, useitem.ItemID))) client.Send(fmsg); } } else { if (!client.Alive) { return; } Enums.ItemLocation loc = (Enums.ItemLocation)packet.Data1; client.Equipments.Equip(useitem, loc, true); } } // else (Reason this is commented out is because it disconnected the client if switching equips too fast lmao. // client.NetworkClient.Disconnect("Using invalid item."); }
public static void Handle(Entities.GameClient client, StringPacket strings) { string Name = strings.Strings[0]; Entities.GameClient reqClient; if (Core.Kernel.Clients.TrySelect(Name, out reqClient)) { string toAdd = reqClient.EntityUID + " "; toAdd += reqClient.Level + " "; toAdd += reqClient.Level + " "; //battle power toAdd += "# "; //unknown toAdd += "# "; //unknown toAdd += reqClient.SpouseName + " "; toAdd += 0 + " "; //unknown if (reqClient.Mesh % 10 < 3) { toAdd += "1 "; } else { toAdd += "0 "; } using (var newstrings = new StringPacket(new StringPacker(Name, toAdd))) { newstrings.Action = Enums.StringAction.WhisperWindowInfo; client.Send(newstrings); } } }
public void SendViewPacket(uint owner, Entities.GameClient client, ushort viewtype = 4) { using (var view = CreateViewPacket(owner, viewtype)) { client.Send(view); } }
public static void Handle(Entities.GameClient client, ItemPacket packet) { uint uid = packet.UID; Data.Booth Booth = Data.Booth.FindBoothFromNPC(uid); if (Booth != null) { if (!Booth.ShopOwner.IsInMap(client)) { return; } if (!Core.Screen.ValidDistance(client.X, client.Y, Booth.ShopOwner.X, Booth.ShopOwner.Y)) { return; } foreach (Data.BoothItem boothItem in Booth.BoothItems.Values) { Data.ItemInfo item = boothItem.GetInfo(Booth.ShopOwner); var viewpacket = item.CreateViewPacket(uid, 1); if (boothItem.IsCP) { viewpacket.ViewType = 3; } viewpacket.Price = boothItem.Price; client.Send(viewpacket); } } }
public static void Handle(Entities.GameClient client, GuildPacket guild) { if (client.Guild != null) { client.Guild.DonateCPs(client, guild.Data); } }
public void SendMessage(Entities.GameClient client, string Message) { using (var msg = Packets.Message.MessageCore.CreateCenter(Message)) { client.Send(msg); } }
public void CreateBooth(Packets.GeneralDataPacket data) { foreach (Maps.IMapObject mapcarpet in ShopOwner.Screen.MapObjects.Values) { if (!(mapcarpet is Entities.NPC)) { return; } Entities.NPC carpet = (mapcarpet as Entities.NPC); if (carpet.NPCType == Enums.NPCType.ShopFlag) { if (!carpet.IsTakenBooth) { if (carpet.X == (ShopOwner.X - 2) && carpet.Y == ShopOwner.Y) { Carpet = carpet; Carpet.IsTakenBooth = true; break; } } } } if (Carpet == null) // could not find a carpet ... { ShopOwner.Booth = null; ShopOwner = null; return; } Carpet.StartVending(ShopOwner.Name, this); Carpet.Screen.UpdateScreen(null); data.Data1 = Carpet.EntityUID; data.Id = ShopOwner.EntityUID; ShopOwner.Send(data); ShopOwner.Screen.FullUpdate(); }
public static void SetUpdate(Entities.GameClient client, Enums.UpdateType type, ulong data, Enums.SynchroType synchro, ulong data2 = 0) { var packet = UpdatePacket.Create(client.EntityUID); if (!packet.AddUpdate(type, data)) { return; } if (synchro != Enums.SynchroType.False) { switch (synchro) { case Enums.SynchroType.True: { client.Send(packet); break; } case Enums.SynchroType.Broadcast: { client.SendToScreen(packet, true); break; } } } }
public static void Handle(Entities.GameClient client, DataPacket packet) { using (var arenaplayers = new ArenaPlayersPacket(Data.ArenaQualifier.GetTop10())) { client.Send(arenaplayers); } }
public static void Create(Entities.GameClient client, Packets.TeamActionPacket packet) { if (packet.EntityUID != client.EntityUID) { return; } if (client.Team != null) { return; } client.Team = new Team(); client.Team.Leader = client.EntityUID; if (client.Team.Members.TryAdd(client.EntityUID, client)) { using (var create = new Packets.TeamActionPacket()) { create.EntityUID = client.EntityUID; create.Action = Enums.TeamAction.Leader; client.Send(create); create.Action = Enums.TeamAction.Create; client.Send(create); } client.AddStatusEffect1(Enums.Effect1.TeamLeader, 0); } else { client.Team = null; } }
public static void Handle(Entities.GameClient client, DataPacket packet) { /*using (var watch = new ArenaWatchPacket(packet)) * { * Entities.GameClient Fighter; * if (Core.Kernel.Clients.TrySelect(watch.EntityUID, out Fighter)) * { * if (Fighter.Battle == null) * return; * if (!(Fighter.Battle is Data.ArenaMatch)) * return; * Data.ArenaMatch Match = Fighter.Battle as Data.ArenaMatch; * * switch (watch.Type) * { * case 0: * { * Match.JoinAsWatcher(client); * //client.Send(packet); * break; * } * case 1: * { * Match.LeaveWatcher(client); * break; * } * } * } * }*/ }
/// <summary> /// Handling the EnterMap action from GeneralDataPacket. /// </summary> /// <param name="client">The client.</param> /// <param name="General">The GeneralDataPacket.</param> public static void Handle(Entities.GameClient client, GeneralDataPacket General) { if (!Core.Kernel.Clients.Contains(client.EntityUID)) { client.NetworkClient.Disconnect("Not added in clients."); return; } ushort SendMap = client.Map.InheritanceMap; GeneralDataPacket mapEnter = new GeneralDataPacket(Enums.DataAction.EnterMap) { Id = SendMap, Data1 = SendMap, Data3Low = client.X, Data3High = client.Y }; client.Send(mapEnter); using (var mapinfo = new Packets.MapInfoPacket()) { mapinfo.MapID = SendMap; mapinfo.DocID = SendMap; // not entire sure what docid is, will figure this out later! foreach (Enums.MapTypeFlags flag in client.Map.Flags.Values) { mapinfo.AddFlag(flag); } mapinfo.Finish(); client.Send(mapinfo); } }
private static Entities.GameClient FindMatchUp(Entities.GameClient Player) { foreach (Entities.GameClient client in PlayerQueue.ToDictionary().Values) { if (client.EntityUID == Player.EntityUID) { continue; } if (client.ArenaMatch != null) { continue; } byte MAX_LEVEL = (byte)(client.Level + 25); byte MIN_LEVEL = (byte)(Player.Level - 25); if (client.Level >= MIN_LEVEL && Player.Level <= MAX_LEVEL) { ushort PLUS_NUM = client.Equipments.GetNumberOfPlus(); PLUS_NUM = (ushort)(PLUS_NUM > 2 ? PLUS_NUM / 2 : PLUS_NUM); if (PLUS_NUM <= client.Equipments.GetNumberOfPlus()) { return(client); } } } return(null); // no match up ... }
public static void Handle(Entities.GameClient client, DataPacket packet) { if (client.Guild == null) { return; } using (var info = new GuildMemberListPacket(packet)) { Data.GuildMember[] members = client.Guild.SelectFromIndex(info.StartIndex); using (var sinfo = new GuildMemberListPacket(members.Length)) { foreach (Data.GuildMember member in members) { sinfo.AddInfo(GuildMemberInfo.Create(member)); } int offset = 16; foreach (GuildMemberInfo minfo in sinfo.MemberList) { minfo.Append(sinfo, offset, out offset); } client.Send(sinfo); } } }
/// <summary> /// Creates a CharacterInfoPacket based on a client's stats. /// </summary> /// <param name="client">The client.</param> /// <returns>Returns the CharacterInfoPacket.</returns> public static CharacterInfoPacket Create(Entities.GameClient client) { CharacterInfoPacket info = new CharacterInfoPacket( new StringPacker(client.Name, "", client.SpouseName)); info.EntityUID = client.EntityUID; info.Mesh = client.Mesh; info.HairStyle = client.HairStyle; info.Money = client.Money; info.CPs = client.CPs; info.Experience = client.Experience; info.Strength = client.Strength; info.Agility = client.Agility; info.Vitality = client.Vitality; info.Spirit = client.Spirit; info.AttributePoints = client.AttributePoints; info.HP = (ushort)client.MaxHP; info.MP = (ushort)client.MaxMP; info.PKPoints = (ushort)client.PKPoints; info.Level = client.Level; info.Class = client.Class; info.NameDisplayed = true; info.PlayerTitle = client.PlayerTitle; return(info); }
public static void Handle(Entities.GameClient client, GeneralDataPacket General) { client.AttackPacket = null; if (client.Booth != null) { client.Booth.CancelBooth(); } if (client.DynamicMap != null) { if (!client.LeaveDynamicMap()) { client.NetworkClient.Disconnect("FAILED_TO_PORTAL_DYNAMIC_MAP"); } return; } if (client.Map.InheritanceMap == client.Map.MapID) { Core.PortalPoint StartLocation = new Core.PortalPoint(client.Map.MapID, General.Data1Low, General.Data1High); if (Core.Screen.ValidDistance(client.X, client.Y, StartLocation.X, StartLocation.Y)) { if (Core.Kernel.Portals.ContainsKey(StartLocation)) { Core.PortalPoint Destination; if (Core.Kernel.Portals.TryGetValue(StartLocation, out Destination)) { client.Teleport(Destination.MapID, Destination.X, Destination.Y); return; } } } } client.Teleport(client.Map.MapID, client.LastX, client.LastY); }
public GuildMember(Entities.GameClient client) { Rank = Enums.GuildRank.Member; DatabaseUID = client.DatabaseUID; Client = client; Name = client.Name; }
/// <summary> /// Gets the physical damage (PVP). /// </summary> /// <param name="attacker">The attacker.</param> /// <param name="attacked">The attacked.</param> /// <returns>Returns the damage.</returns> private static double GetPhysicalDamage_PVP(Entities.GameClient attacker, Entities.GameClient attacked) { double damage = ProjectX_V3_Lib.ThreadSafe.RandomGenerator.Generator.Next(attacker.MinAttack, attacker.MaxAttack); damage *= 1 + attacker.DragonGemPercentage; damage -= attacked.Defense; if (attacked.ContainsFlag1(Enums.Effect1.Shield)) { damage *= 0.5; } if (attacker.ContainsFlag1(Enums.Effect1.Stig)) { damage *= 1.75; } double damage_perc = damage; damage_perc = (damage / 100) * attacked.TortoiseGemPercentage; damage -= damage_perc; damage_perc = (damage / 100) * attacked.Bless; damage -= damage_perc; return(damage); }
/// <summary> /// Gets the physical magic damage. (MVP) /// </summary> /// <param name="attacker">The attacker.</param> /// <param name="attacked">The attacked.</param> /// <param name="spell">The spell.</param> /// <returns>Returns the damage.</returns> private static double GetPhysicalMagicDamage_MVP(Entities.Monster attacker, Entities.GameClient attacked, Data.Spell spell) { double damage = (double)ProjectX_V3_Lib.ThreadSafe.RandomGenerator.Generator.Next((int)attacker.MaxAttack, (int)attacker.MaxAttack * 2); damage -= attacked.Defense; damage *= 0.65; // penetration extra damage if (spell.SpellID == 1290 && damage > 0) { double hunperc = (double)((damage / 100) * 26.6); damage += (hunperc * spell.Level); } if (attacked.ContainsFlag1(Enums.Effect1.Shield)) { damage *= 0.5; } // damage += spell.Power; //damage *= 1 + attacker.PhoenixGemPercentage; // damage -= attacked.Defense; // double damage_perc = damage; // damage_perc = (damage / 100) * attacked.TortoiseGemPercentage; // damage -= damage_perc; // damage_perc = (damage / 100) * attacked.Bless; // damage -= damage_perc; return(damage); }
/// <summary> /// Handles the SetMoney subtype of the TradePacket. /// </summary> /// <param name="client">The client.</param> /// <param name="trade">The trade packet.</param> public static void Handle(Entities.GameClient client, TradePacket trade) { if (!client.Trade.Trading) { return; } if (!client.Trade.WindowOpen) { return; } uint money = trade.TargetUID; if (money > client.Money) { using (var fmsg = Message.MessageCore.CreateSystem(client.Name, Core.MessageConst.LOW_MONEY_TRADE)) { client.Send(fmsg); } return; } client.Trade.Money = money; trade.TradeType = Enums.TradeType.ShowMoney; client.Trade.Partner.Send(trade); }
public static void Handle(Entities.GameClient client, DataPacket packet) { using (var wait = client.Arena.Build()) { client.Send(wait); } }
public static void Handle(Entities.GameClient client, DataPacket packet) { using (var interact = new InteractionPacket(packet)) { switch (interact.Action) { #region Marriage case Enums.InteractAction.Marry: Interaction.Misc.Marry.Handle(client, interact); break; #endregion #region Court case Enums.InteractAction.Court: Interaction.Misc.Court.Handle(client, interact); break; #endregion #region Combat case Enums.InteractAction.Attack: case Enums.InteractAction.MagicAttack: case Enums.InteractAction.Shoot: Interaction.Battle.Combat.Handle(client, interact); break; #endregion } } }
/// <summary> /// Handling the Court action of the interaction packet. /// </summary> /// <param name="client">The client.</param> /// <param name="interact">The interaction packet.</param> public static void Handle(Entities.GameClient client, InteractionPacket interact) { //uint marryUID = interact.TargetUID; //Entities.GameClient marrytarget; Maps.IMapObject obj; if (client.Map.MapObjects.TryGetValue(interact.TargetUID, out obj)) { Entities.GameClient targ = obj as Entities.GameClient; if (client.SpouseDatabaseUID > 0) { using (var fmsg = Message.MessageCore.CreateSystem2(client.Name, Core.MessageConst.MARRIAGE_SELF_SPOUSE)) client.Send(fmsg); return; } if (targ.SpouseDatabaseUID > 0) { using (var fmsg = Message.MessageCore.CreateSystem2(client.Name, Core.MessageConst.MARRIAGE_TARGET_SPOUSE)) client.Send(fmsg); return; } targ.Send(interact); } }
public static bool Handle(Entities.GameClient client, UseSpellPacket usespell) { if (!client.Equipments.Contains(Enums.ItemLocation.Steed)) { return(false); } if (client.ContainsFlag1(Enums.Effect1.Riding)) { client.RemoveFlag1(Enums.Effect1.Riding); } else if (client.Stamina < 100) { return(false); } else { client.AddStatusEffect1(Enums.Effect1.Riding); } using (var vigor = new Packets.SteedVigorPacket()) { vigor.Type = 2; vigor.Amount = 9001; client.Send(vigor); } usespell.AddTarget(client.EntityUID, 0); return(true); }
/// <summary> /// Handling the GetSurroundings action from GeneralDataPacket. /// </summary> /// <param name="client">The client.</param> /// <param name="General">The GeneralDataPacket.</param> public static void Handle(Entities.GameClient client, GeneralDataPacket General) { if (client.LoggedIn) { if (client.Booth != null) { client.Booth.CancelBooth(); } client.Screen.ClearScreen(); client.Screen.UpdateScreen(null); if (client.WasInArena) { client.WasInArena = false; if (client.LostArena) { Data.ArenaMatch.SendLose(client); } else { Data.ArenaMatch.SendWin(client); } } Threads.WeatherThread.ShowWeather(client); } }
/// <summary> /// Handles the SetConquerPoints subtype of the TradePacket. /// </summary> /// <param name="client">The client.</param> /// <param name="trade">The trade packet.</param> public static void Handle(Entities.GameClient client, TradePacket trade) { if (!client.Trade.Trading) { return; } if (!client.Trade.WindowOpen) { return; } uint cps = trade.TargetUID; if (cps > client.CPs) { using (var fmsg = Message.MessageCore.CreateSystem(client.Name, Core.MessageConst.LOW_CPS_TRADE)) { client.Send(fmsg); } return; } client.Trade.CPs = cps; trade.TradeType = Enums.TradeType.ShowConquerPoints; client.Trade.Partner.Send(trade); }
public void AddMember(Entities.GameClient client) { if (Members.Contains(client.DatabaseUID)) { client.GuildMemberInfo = Members[client.DatabaseUID]; } else { client.GuildMemberInfo = new GuildMember(client); if (Members.TryAdd(client.DatabaseUID, client.Name, client.GuildMemberInfo)) { client.Guild = this; SendMessage(string.Format(Core.MessageConst.NEW_MEMBER, client.Name)); } else { client.GuildMemberInfo = null; } Database.CharacterDatabase.Save(client); } ReorderIndex(); client.SendGuild(); client.Screen.FullUpdate(); }
public static bool Handle(Entities.IEntity attacker, Entities.IEntity target, InteractionPacket interaction, UseSpellPacket usespell, Data.Spell spell, out uint damage) { damage = 0; if (!attacker.Alive) { return(false); } if (target == null) { return(false); } if (target.Alive) { return(false); } if (attacker.EntityUID == target.EntityUID) { return(false); } if (!(target is Entities.GameClient)) { return(false); } Entities.GameClient TargetClient = (target as Entities.GameClient); TargetClient.ForceRevive(); usespell.AddTarget(TargetClient.EntityUID, 0); return(true); }
/// <summary> /// Handling the ChangeDirection action from GeneralDataPacket. /// </summary> /// <param name="client">The client.</param> /// <param name="General">The GeneralDataPacket.</param> public static void Handle(Entities.GameClient client, GeneralDataPacket General) { client.Direction = (byte)General.Direction; client.AttackPacket = null; client.SendToScreen(General, false); }
public ArenaMatch(Entities.GameClient Player1, Entities.GameClient Player2) { Started = false; AcceptedFight1 = false; AcceptedFight2 = false; Player1.ArenaMatch = this; this.Player1 = Player1; this.Player2 = Player2; Watchers = new ConcurrentArrayList<ProjectX_V3_Game.Entities.GameClient>(); }
public ArenaInfo(Entities.GameClient Owner) { this.Owner = Owner; DatabaseID = Owner.DatabaseUID; this.Mesh = Owner.Mesh; this.Name = Owner.Name; this.Level = (uint)Owner.Level; this.Class = (uint)Owner.Class; IsBot = Owner.IsAIBot; }
public void CancelBooth() { BoothItems.Clear(); Carpet.StopVending(); Carpet.Name = ""; Carpet.Screen.FullUpdate(); Carpet = null; ShopOwner.Booth = null; ShopOwner.Screen.FullUpdate(); ShopOwner = null; }
/// <summary> /// Begins the chat + resets. /// </summary> /// <param name="partner">The trade partner.</param> public void Begin(Entities.GameClient partner) { if (Items.Count > 0) Items.Clear(); Items = new List<ItemInfo>(); Money = 0; CPs = 0; Trading = true; Accepted = false; Confirmed = false; WindowOpen = false; Partner = partner; }
public void EndMatch() { if (EndedAlready) return; EndedAlready = true; bool IsBotMatch = (Player1.IsAIBot || Player2.IsAIBot); Player1.Equipments.ClearMask(); if (Player2 != null) Player2.Equipments.ClearMask(); Player1.ArenaMatch = null; if (Player2 != null) Player2.ArenaMatch = null; Player1.Battle = null; if (Player2 != null) Player2.Battle = null; SendEnd(); if (Player2 != null) { uint WinAmount = (uint)ProjectX_V3_Lib.ThreadSafe.RandomGenerator.Generator.Next(32, 113); uint LoseAmount = (uint)ProjectX_V3_Lib.ThreadSafe.RandomGenerator.Generator.Next((int)(WinAmount / 3), (int)(WinAmount / 2)); LoseAmount /= 2; if (IsBotMatch) { WinAmount = 0; LoseAmount = 0; } if (Player1Damage == Player2Damage) { Player1.WasInArena = true; Player2.WasInArena = true; Player1.LostArena = true; Player2.LostArena = true; // draw if (!IsBotMatch) { Player1.Arena.ArenaHonorPoints += LoseAmount; Player2.Arena.ArenaHonorPoints += LoseAmount; using (var msg = Packets.Message.MessageCore.CreateSystem2("ALL", string.Format(Core.MessageConst.ARENA_DRAW, Player1.Name, Player2.Name))) { Packets.Message.MessageCore.SendGlobalMessage(msg); } } } else if (Player1Damage > Player2Damage) { Player1.WasInArena = true; Player2.WasInArena = true; Player2.LostArena = true; Player1.LostArena = false; if (!IsBotMatch) { // player1 win Player1.Arena.ArenaHonorPoints += WinAmount; Player2.Arena.ArenaHonorPoints -= LoseAmount; Player1.Arena.ArenaWinsToday++; Player1.Arena.ArenaTotalWins++; //Player1.Send(arenaAction); Player2.Arena.ArenaLossToday++; Player2.Arena.ArenaTotalLoss++; using (var msg = Packets.Message.MessageCore.CreateSystem2("ALL", string.Format(Core.MessageConst.ARENA_WIN, Player1.Name, Player2.Name))) { Packets.Message.MessageCore.SendGlobalMessage(msg); } } } else { Player1.WasInArena = true; Player2.WasInArena = true; Player1.LostArena = true; Player2.LostArena = false; // player 2 win if (!IsBotMatch) { Player2.Arena.ArenaHonorPoints += WinAmount; Player1.Arena.ArenaHonorPoints -= LoseAmount; Player2.Arena.ArenaWinsToday++; Player2.Arena.ArenaTotalWins++; Player1.Arena.ArenaLossToday++; Player1.Arena.ArenaTotalLoss++; using (var msg = Packets.Message.MessageCore.CreateSystem2("ALL", string.Format(Core.MessageConst.ARENA_WIN, Player2.Name, Player1.Name))) { Packets.Message.MessageCore.SendGlobalMessage(msg); } } } } if (!Player1.LeaveDynamicMap()) Player1.NetworkClient.Disconnect("Could not leave arena..."); Player1.ForceRevive(); if (Player2 != null) { if (!Player2.LeaveDynamicMap()) Player2.NetworkClient.Disconnect("Could not leave arena..."); Player2.ForceRevive(); } KickWatchers(); if (Player2 != null) { if (!IsBotMatch) { Player1.Arena.Save(); Player2.Arena.Save(); } } ArenaQualifier.GetTop10(); Player1.Arena.Status = Enums.ArenaStatus.NotSignedUp; using (var wait = Player1.Arena.Build()) Player1.Send(wait); if (Player2 != null) { Player2.Arena.Status = Enums.ArenaStatus.NotSignedUp; using (var wait = Player2.Arena.Build()) Player2.Send(wait); } Player1 = null; Player2 = null; ArenaQualifier.MatchQueue.Remove(this); }
public void GiveUp(Entities.GameClient Player) { if (EndedAlready) return; EndedAlready = true; Player1.Equipments.ClearMask(); Player2.Equipments.ClearMask(); if (Player1 == Player) { SendGiveUp(Player2); SendWin(Player2); Player1.Arena.Status = Enums.ArenaStatus.WaitingInactive; using (var wait = Player1.Arena.Build()) Player1.Send(wait); Player2.Arena.Status = Enums.ArenaStatus.WaitingForOpponent; using (var wait = Player2.Arena.Build()) Player2.Send(wait); } else { SendGiveUp(Player1); SendWin(Player1); Player1.Arena.Status = Enums.ArenaStatus.WaitingForOpponent; using (var wait = Player1.Arena.Build()) Player1.Send(wait); Player2.Arena.Status = Enums.ArenaStatus.WaitingInactive; using (var wait = Player2.Arena.Build()) Player2.Send(wait); } Player1.ArenaMatch = null; Player2.ArenaMatch = null; Player1.Battle = null; Player2.Battle = null; uint WinAmount = (uint)ProjectX_V3_Lib.ThreadSafe.RandomGenerator.Generator.Next(32, 113); uint LoseAmount = (uint)ProjectX_V3_Lib.ThreadSafe.RandomGenerator.Generator.Next((int)(WinAmount / 3), (int)(WinAmount / 2)); LoseAmount /= 2; if (Player != Player1) { Player1.Arena.ArenaHonorPoints += WinAmount; Player2.Arena.ArenaHonorPoints -= LoseAmount; } else { Player2.Arena.ArenaHonorPoints += WinAmount; Player1.Arena.ArenaHonorPoints -= LoseAmount; } Player1.Arena.Save(); Player2.Arena.Save(); ArenaQualifier.GetTop10(); Player1 = null; Player2 = null; ArenaQualifier.MatchQueue.Remove(this); }
/// <summary> /// Creates a new instance of SpellData. /// </summary> /// <param name="owner">The owner.</param> public SpellData(Entities.GameClient owner) { this.Owner = owner; Profs = new ConcurrentDictionary<ushort, SpellInfo>(); Spells = new ConcurrentDictionary<ushort, SpellInfo>(); }
/// <summary> /// Does a full reset of the trade. /// </summary> public void Reset() { if (Items.Count > 0) Items.Clear(); Items = new List<ItemInfo>(); Money = 0; CPs = 0; Trading = false; Accepted = false; Confirmed = false; Requesting = false; WindowOpen = false; Partner = null; }
/// <summary> /// Creates a new instance of Equipments. /// </summary> /// <param name="owner">The owner of the equipments.</param> public Equipments(Entities.GameClient owner) { this.Owner = owner; EquipmentItems = new ConcurrentDictionary<ProjectX_V3_Game.Enums.ItemLocation, ItemInfo>(); }
public void CreateBooth(Packets.GeneralDataPacket data) { foreach (Maps.IMapObject mapcarpet in ShopOwner.Screen.MapObjects.Values) { if (!(mapcarpet is Entities.NPC)) return; Entities.NPC carpet = (mapcarpet as Entities.NPC); if (carpet.NPCType == Enums.NPCType.ShopFlag) { if (!carpet.IsTakenBooth) { if (carpet.X == (ShopOwner.X - 2) && carpet.Y == ShopOwner.Y) { Carpet = carpet; Carpet.IsTakenBooth = true; break; } } } } if (Carpet == null) // could not find a carpet ... { ShopOwner.Booth = null; ShopOwner = null; return; } Carpet.StartVending(ShopOwner.Name, this); Carpet.Screen.UpdateScreen(null); data.Data1 = Carpet.EntityUID; data.Id = ShopOwner.EntityUID; ShopOwner.Send(data); ShopOwner.Screen.FullUpdate(); }
/// <summary> /// Creates a new instance of Inventory. /// </summary> /// <param name="owner">The owner of the inventory.</param> public Inventory(Entities.GameClient owner) { this.Owner = owner; inventoryItems = new ConcurrentDictionary<byte, ItemInfo>(); }
/// <summary> /// Creates a new instance of Warehouse. /// </summary> /// <param name="owner">The owner of the warehouse.</param> /// <param name="MapID">The wh id of the warehouse.</param> public Warehouse(Entities.GameClient owner, ushort WhID) { this.Owner = owner; warehouseItems = new ConcurrentDictionary<byte, ItemInfo>(); this.WhID = WhID; }