public static void AppendActiveTeam(Client client, PacketHitList hitlist) { TcpPacket packet = new TcpPacket("activeteam"); Player player = client.Player; for (int i = 0; i < Constants.MAX_ACTIVETEAM; i++) { if (client.Player.Team[i].Loaded == true) { packet.AppendParameters(player.Team[i].Name, player.Team[i].Species.ToString(), player.Team[i].Form.ToString(), ((int)player.Team[i].Shiny).ToString(), ((int)player.Team[i].Sex).ToString(), player.Team[i].HP.ToString(), player.Team[i].MaxHP.ToString(), Server.Math.CalculatePercent(player.Team[i].Exp, Exp.ExpManager.Exp[player.Team[i].Level - 1]).ToString(), player.Team[i].Level.ToString(), ((int)player.Team[i].StatusAilment).ToString(), player.Team[i].HeldItemSlot.ToString()); } else { packet.AppendParameter("notloaded"); } } packet.FinalizePacket(); hitlist.AddPacket(client, packet); }
public void AppendFriendsList(PacketHitList hitlist) { TcpPacket packet = new TcpPacket("friendslist"); packet.AppendParameter(Friends.Count); for (int i = 0; i < Friends.Count; i++) { Client clientIsOn = ClientManager.FindClient(Friends[i]); int ison; if (clientIsOn != null) { ison = 1; } else { ison = 0; } packet.AppendParameters(Friends[i], ison.ToString()); } packet.FinalizePacket(); hitlist.AddPacket(client, packet); }
private void AddPacket(Client client, TcpPacket packet) { hitList.AddPacket(client, packet, true); }
public static void AppendAdminMsg(PacketHitList hitlist, string Msg, Color Color) { foreach (Client i in ClientManager.GetClients()) { if (i.IsPlaying() && Ranks.IsAllowed(i, Enums.Rank.Moniter)) { hitlist.AddPacket(i, TcpPacket.CreatePacket("msg", Msg, Color.ToArgb().ToString())); } } }
public static void AppendMobility(Client client, PacketHitList hitlist) { int mobility = 0; for (int i = 15; i >= 0; i--) { if (client.Player.GetActiveRecruit().Mobility[i]) { mobility += (int)System.Math.Pow(2, i); } } hitlist.AddPacket(client, TcpPacket.CreatePacket("mobility", mobility.ToString())); }
/* public static TcpPacket CreateAllArrowsPacket() { TcpPacket packet = new TcpPacket("allarrowsdata"); for (int i = 1; i <= Constants.MAX_ARROWS; i++) { packet.AppendParameters(i.ToString(), Arrows.ArrowManagerBase.Arrows[i - 1].Name, Arrows.ArrowManagerBase.Arrows[i - 1].Pic.ToString(), Arrows.ArrowManagerBase.Arrows[i - 1].Range.ToString(), Arrows.ArrowManagerBase.Arrows[i - 1].Amount.ToString()); } packet.FinalizePacket(); return packet; } public static TcpPacket CreateAllDungeonsPacket() { TcpPacket packet = new TcpPacket("alldungeons"); packet.AppendParameter(Dungeons.DungeonManager.Dungeons.Count.ToString()); for (int i = 0; i < Dungeons.DungeonManager.Dungeons.Count; i++) { packet.AppendParameters(Dungeons.DungeonManager.Dungeons[i].Name); } packet.FinalizePacket(); return packet; } public static TcpPacket CreateAllPokemonPacket() { TcpPacket packet = new TcpPacket("allpokemon"); packet.AppendParameter(Constants.TOTAL_POKEMON); for (int i = 1; i <= Constants.TOTAL_POKEMON; i++) { packet.AppendParameters(Pokedex.Pokedex.GetPokemon(i).Name); } packet.FinalizePacket(); return packet; } public static TcpPacket CreateAllEmotionsPacket() { TcpPacket packet = new TcpPacket("allemoticonsdata"); for (int i = 0; i <= Settings.MaxEmoticons; i++) { packet.AppendParameters(i.ToString(), Emoticons.EmoticonManagerBase.Emoticons[i].Command, Emoticons.EmoticonManagerBase.Emoticons[i].Pic.ToString()); } packet.FinalizePacket(); return packet; } public static TcpPacket CreateAllEvosPacket() { TcpPacket packet = new TcpPacket("allevosdata"); for (int i = 0; i <= Evolutions.EvolutionManager.Evolutions.MaxEvos; i++) { packet.AppendParameters(i.ToString(), Evolutions.EvolutionManager.Evolutions[i].Name); } packet.FinalizePacket(); return packet; } public static TcpPacket CreateAllItemsPacket() { TcpPacket packet = new TcpPacket("allitemsdata"); for (int i = 1; i <= Items.ItemManager.Items.MaxItems; i++) { if (Items.ItemManager.Items[i].Name.Trim() != "") { packet.AppendParameters(i.ToString(), Items.ItemManager.Items[i].Name.Trim(), Items.ItemManager.Items[i].Desc.Trim(), Items.ItemManager.Items[i].Pic.ToString(), ((int)Items.ItemManager.Items[i].Type).ToString(), Items.ItemManager.Items[i].Data1.ToString(), Items.ItemManager.Items[i].Data2.ToString(), Items.ItemManager.Items[i].Data3.ToString(), Items.ItemManager.Items[i].Price.ToString(), Items.ItemManager.Items[i].Stackable.ToIntString(), Items.ItemManager.Items[i].Bound.ToIntString(), Items.ItemManager.Items[i].Loseable.ToIntString(), Items.ItemManager.Items[i].Rarity.ToString(), Items.ItemManager.Items[i].AttackReq.ToString(), Items.ItemManager.Items[i].DefenseReq.ToString(), Items.ItemManager.Items[i].SpAtkReq.ToString(), Items.ItemManager.Items[i].SpDefReq.ToString(), Items.ItemManager.Items[i].SpeedReq.ToString(), Items.ItemManager.Items[i].ScriptedReq.ToString(), Items.ItemManager.Items[i].AddHP.ToString(), Items.ItemManager.Items[i].AddPP.ToString(), Items.ItemManager.Items[i].AddAttack.ToString(), Items.ItemManager.Items[i].AddDefense.ToString(), Items.ItemManager.Items[i].AddSpAtk.ToString(), Items.ItemManager.Items[i].AddSpDef.ToString(), Items.ItemManager.Items[i].AddSpeed.ToString(), Items.ItemManager.Items[i].AddEXP.ToString(), Items.ItemManager.Items[i].AttackSpeed.ToString(), Items.ItemManager.Items[i].RecruitBonus.ToString()); } else { packet.AppendParameters(i.ToString(), 0.ToString()); } } packet.FinalizePacket(); return packet; } public static TcpPacket CreateAllNpcsPacket() { TcpPacket packet = new TcpPacket("allnpcsdata"); for (int i = 1; i <= Npcs.NpcManager.Npcs.MaxNpcs; i++) { packet.AppendParameters(i.ToString(), Npcs.NpcManager.Npcs[i].Name.Trim(), Npcs.NpcManager.Npcs[i].Sprite.ToString()); } packet.FinalizePacket(); return packet; } public static TcpPacket CreateAllRDungeonsPacket() { TcpPacket packet = new TcpPacket("allrdungeons"); packet.AppendParameter(RDungeons.RDungeonManager.RDungeons.Count); for (int i = 0; i < RDungeons.RDungeonManager.RDungeons.Count; i++) { packet.AppendParameters(RDungeons.RDungeonManager.RDungeons[i].DungeonName.Trim()); } packet.FinalizePacket(); return packet; } public static TcpPacket CreateAllShopsPacket() { TcpPacket packet = new TcpPacket("allshopsdata"); for (int i = 1; i <= Shops.ShopManager.Shops.MaxShops; i++) { packet.AppendParameters(i.ToString(), Shops.ShopManager.Shops[i].Name.Trim()); } packet.FinalizePacket(); return packet; } public static TcpPacket CreateAllSpellsPacket() { TcpPacket packet = new TcpPacket("allspellsdata"); for (int i = 1; i <= Moves.MoveManager.Moves.MaxMoves; i++) { packet.AppendParameters( i.ToString(), Moves.MoveManager.Moves[i].Name.Trim(), ((int)Moves.MoveManager.Moves[i].RangeType).ToString(), Moves.MoveManager.Moves[i].Range.ToString(), ((int)Moves.MoveManager.Moves[i].TargetType).ToString() ); } packet.FinalizePacket(); return packet; } public static TcpPacket CreateAllStoryNamesPacket() { TcpPacket packet = new TcpPacket("allstoriesdata"); for (int i = 0; i <= Stories.StoryManager.Stories.MaxStories; i++) { if (!string.IsNullOrEmpty(Stories.StoryManager.Stories[i].Name)) { packet.AppendParameters(Stories.StoryManager.Stories[i].Name); } else { packet.AppendParameters(""); } } packet.FinalizePacket(); return packet; } */ public static void AppendMaxInfo(Client client, PacketHitList hitlist) { hitlist.AddPacket(client, TcpPacket.CreatePacket("maxinfo", Settings.GameName, Items.ItemManager.Items.MaxItems.ToString(), Npcs.NpcManager.Npcs.MaxNpcs.ToString(), Shops.ShopManager.Shops.MaxShops.ToString(), Moves.MoveManager.Moves.MaxMoves.ToString(), Constants.MAX_MAP_ITEMS.ToString(), Constants.MAX_MAP_X.ToString(), Constants.MAX_MAP_Y.ToString(), /*Settings.MaxEmoticons*/"10", Evolutions.EvolutionManager.Evolutions.MaxEvos.ToString(), Stories.StoryManager.Stories.MaxStories.ToString())); }
public static void AppendMapItems(Client client, PacketHitList hitlist, IMap map, bool temp) { TcpPacket packet = new TcpPacket("mapitemdata"); packet.AppendParameter(map.MapID); packet.AppendParameter(temp.ToIntString()); for (int i = 0; i < Constants.MAX_MAP_ITEMS; i++) {//server will lie to the client and send all hidden items as blank if (!map.ActiveItem[i].Hidden) { packet.AppendParameters(map.ActiveItem[i].Num.ToString(), map.ActiveItem[i].Value.ToString(), map.ActiveItem[i].Sticky.ToIntString(), map.ActiveItem[i].X.ToString(), map.ActiveItem[i].Y.ToString()); } else { packet.AppendParameters("0", "0", "0", "0", "0"); } } packet.FinalizePacket(); hitlist.AddPacket(client, packet); }
public static void AppendMapData(Client client, PacketHitList hitlist, IMap map, Enums.MapID mapType) { TcpPacket packet = new TcpPacket("mapdata"); int x, y; if (map.MaxX == 0) map.MaxX = 19; if (map.MaxY == 0) map.MaxY = 14; packet.AppendParameter((int)mapType); packet.AppendParameters(map.MapID, map.Name.Trim(), map.Revision.ToString(), ((int)map.Moral).ToString(), map.Up.ToString(), map.Down.ToString(), map.Left.ToString(), map.Right.ToString(), map.Music, map.Indoors.ToIntString(), ((int)map.Weather).ToString(), map.MaxX.ToString(), map.MaxY.ToString(), map.Darkness.ToString(), map.HungerEnabled.ToIntString(), map.RecruitEnabled.ToIntString(), map.ExpEnabled.ToIntString(), map.TimeLimit.ToString(), map.MinNpcs.ToString(), map.MaxNpcs.ToString(), map.NpcSpawnTime.ToString(), map.Cacheable.ToIntString()); if (map.MapType == Enums.MapType.Instanced) { string mapBase = MapManager.GenerateMapID(((InstancedMap)map).MapBase); packet.AppendParameter(mapBase); } else { packet.AppendParameter(""); } for (y = 0; y <= map.MaxY; y++) { for (x = 0; x <= map.MaxX; x++) { packet.AppendParameters(map.Tile[x, y].Ground.ToString(), map.Tile[x, y].GroundAnim.ToString(), map.Tile[x, y].Mask.ToString(), map.Tile[x, y].Anim.ToString(), map.Tile[x, y].Mask2.ToString(), map.Tile[x, y].M2Anim.ToString(), map.Tile[x, y].Fringe.ToString(), map.Tile[x, y].FAnim.ToString(), map.Tile[x, y].Fringe2.ToString(), map.Tile[x, y].F2Anim.ToString(), ((int)map.Tile[x, y].Type).ToString(), map.Tile[x, y].Data1.ToString(), map.Tile[x, y].Data2.ToString(), map.Tile[x, y].Data3.ToString(), map.Tile[x, y].String1, map.Tile[x, y].String2, map.Tile[x, y].String3, map.Tile[x, y].RDungeonMapValue.ToString(), map.Tile[x, y].GroundSet.ToString(), map.Tile[x, y].GroundAnimSet.ToString(), map.Tile[x, y].MaskSet.ToString(), map.Tile[x, y].AnimSet.ToString(), map.Tile[x, y].Mask2Set.ToString(), map.Tile[x, y].M2AnimSet.ToString(), map.Tile[x, y].FringeSet.ToString(), map.Tile[x, y].FAnimSet.ToString(), map.Tile[x, y].Fringe2Set.ToString(), map.Tile[x, y].F2AnimSet.ToString()); } } packet.AppendParameter(map.Npc.Count); for (x = 0; x < map.Npc.Count; x++) { packet.AppendParameters(map.Npc[x].NpcNum, map.Npc[x].SpawnX, map.Npc[x].SpawnY, map.Npc[x].MinLevel, map.Npc[x].MaxLevel, map.Npc[x].AppearanceRate, (int)map.Npc[x].StartStatus, map.Npc[x].StartStatusCounter, map.Npc[x].StartStatusChance); } packet.AppendParameter(map.TempChange.ToIntString()); packet.FinalizePacket(); hitlist.AddPacket(client, packet); }
public static void AppendConnectionID(Client client, PacketHitList hitlist) { hitlist.AddPacket(client, TcpPacket.CreatePacket("myconid", client.ConnectionID.ToString())); }
public static void AppendConfusion(Client client, PacketHitList hitlist) { hitlist.AddPacket(client, TcpPacket.CreatePacket("confusion", client.Player.GetActiveRecruit().Confused.ToIntString())); //hitlist.AddPacketToOthers(client.Player.GetActiveRecruit(), client.Player.Map, CreatePlayerConfusion(client), Enums.OutdateType.Condition); }
public static void AppendBelly(Client client, PacketHitList hitlist) { hitlist.AddPacket(client, TcpPacket.CreatePacket("recruitbelly", client.Player.GetActiveRecruit().Belly.ToString(), client.Player.GetActiveRecruit().MaxBelly.ToString())); }
public static void AppendAvailableExpKitModules(Client client, PacketHitList hitlist) { TcpPacket packet = new TcpPacket("kitmodules"); packet.AppendParameter(client.Player.AvailableExpKitModules.Count); for (int i = 0; i < client.Player.AvailableExpKitModules.Count; i++) { packet.AppendParameter((int)client.Player.AvailableExpKitModules[i].Type); } packet.FinalizePacket(); hitlist.AddPacket(client, packet); }
public static void AppendAllStoryNames(Client client, PacketHitList hitlist) { TcpPacket packet = new TcpPacket("allstoriesdata"); for (int i = 0; i <= Stories.StoryManager.Stories.MaxStories; i++) { if (!string.IsNullOrEmpty(Stories.StoryManager.Stories[i].Name)) { packet.AppendParameters(Stories.StoryManager.Stories[i].Name); } else { packet.AppendParameters(""); } } packet.FinalizePacket(); hitlist.AddPacket(client, packet); }
public static void AppendAllSpells(Client client, PacketHitList hitlist) { TcpPacket packet = new TcpPacket("allspellsdata"); for (int i = 1; i <= Moves.MoveManager.Moves.MaxMoves; i++) { packet.AppendParameters( i.ToString(), Moves.MoveManager.Moves[i].Name.Trim(), ((int)Moves.MoveManager.Moves[i].RangeType).ToString(), Moves.MoveManager.Moves[i].Range.ToString(), ((int)Moves.MoveManager.Moves[i].TargetType).ToString(), Moves.MoveManager.Moves[i].HitTime.ToString(), Moves.MoveManager.Moves[i].HitFreeze.ToIntString()); } packet.FinalizePacket(); hitlist.AddPacket(client, packet); }
public static void AppendAllShops(Client client, PacketHitList hitlist) { TcpPacket packet = new TcpPacket("allshopsdata"); for (int i = 1; i <= Shops.ShopManager.Shops.MaxShops; i++) { packet.AppendParameters(i.ToString(), Shops.ShopManager.Shops[i].Name.Trim()); } packet.FinalizePacket(); hitlist.AddPacket(client, packet); }
public static void AppendMapDarkness(Client client, PacketHitList hitlist, IMap map) { hitlist.AddPacket(client, TcpPacket.CreatePacket("darkness", (map.Darkness).ToString())); }
public static void AppendDarkness(Client client, PacketHitList hitlist) { hitlist.AddPacket(client, TcpPacket.CreatePacket("selfdarkness", client.Player.GetActiveRecruit().Darkness)); }
public static void AppendMapDone(Client client, PacketHitList hitlist) { //client.Player.GettingMap = false; hitlist.AddPacket(client, TcpPacket.CreatePacket("mapdone")); }
public static void AppendEmote(Client client, int emote, int speed, int rounds, PacketHitList hitlist) { TcpPacket myPacket = TcpPacket.CreatePacket("emote", emote.ToString(), speed.ToString(), rounds.ToString()); hitlist.AddPacket(client, myPacket); hitlist.AddPacketToOthers(client.Player.GetActiveRecruit(), client.Player.Map, CreatePlayerEmote(client, emote, speed, rounds), Enums.OutdateType.Condition); }
public static void AppendMapNpcs(Client client, PacketHitList hitlist, IMap map, bool temp) { TcpPacket packet = new TcpPacket("mapnpcdata"); packet.AppendParameter(map.MapID); packet.AppendParameter(temp.ToIntString()); for (int i = 0; i < Constants.MAX_MAP_NPCS; i++) { if ((int)map.ActiveNpc[i].Direction > 3) map.ActiveNpc[i].Direction = Enums.Direction.Right; packet.AppendParameters(map.ActiveNpc[i].Num.ToString(), map.ActiveNpc[i].Sprite.ToString(), map.ActiveNpc[i].Form.ToString(), ((int)map.ActiveNpc[i].Shiny).ToString(), ((int)map.ActiveNpc[i].Sex).ToString(), map.ActiveNpc[i].X.ToString(), map.ActiveNpc[i].Y.ToString(), ((int)map.ActiveNpc[i].Direction).ToString(), ((int)map.ActiveNpc[i].StatusAilment).ToString()); if (map.ActiveNpc[i].Num > 0 && NpcManager.Npcs[map.ActiveNpc[i].Num].Behavior != Enums.NpcBehavior.Friendly && NpcManager.Npcs[map.ActiveNpc[i].Num].Behavior != Enums.NpcBehavior.Shopkeeper && NpcManager.Npcs[map.ActiveNpc[i].Num].Behavior != Enums.NpcBehavior.Scripted) { packet.AppendParameters("1"); } else { packet.AppendParameters("0"); } } packet.FinalizePacket(); hitlist.AddPacket(client, packet); }
public static void AppendEXP(Client client, PacketHitList hitlist) { hitlist.AddPacket(client, TcpPacket.CreatePacket("playerexp", client.Player.GetActiveRecruit().GetNextLevel().ToString(), client.Player.GetActiveRecruit().Exp.ToString())); if (!string.IsNullOrEmpty(client.Player.PartyID)) { Party playerParty = PartyManager.FindPlayerParty(client); AppendPartyMemberData(client, hitlist, playerParty.GetMemberSlot(client.Player.CharID)); //CreateDataForParty(playerParty, client, playerParty.Members.GetMemberSlot(client.Player.CharID)); } }
public static void AppendActiveTeamNum(Client client, PacketHitList hitlist) { hitlist.AddPacket(client, TcpPacket.CreatePacket("activeteamnum", client.Player.ActiveSlot.ToString())); }
public static void AppendHP(Client client, int recruitIndex, PacketHitList hitlist) { hitlist.AddPacket(client, TcpPacket.CreatePacket("playerhp", recruitIndex.ToString(), client.Player.Team[recruitIndex].MaxHP.ToString(), client.Player.Team[recruitIndex].HP.ToString())); if (!string.IsNullOrEmpty(client.Player.PartyID)) { Party playerParty = PartyManager.FindPlayerParty(client); AppendPartyMemberData(client, hitlist, playerParty.GetMemberSlot(client.Player.CharID)); } }
public static void AppendMovePPUpdate(Client client, PacketHitList hitlist, int moveSlot) { hitlist.AddPacket(client, TcpPacket.CreatePacket("moveppupdate", moveSlot.ToString(), client.Player.GetActiveRecruit().Moves[moveSlot].CurrentPP.ToString(), client.Player.GetActiveRecruit().Moves[moveSlot].MaxPP.ToString())); }
public static void AppendHunted(Client client, PacketHitList hitlist) { hitlist.AddPacket(client, TcpPacket.CreatePacket("hunted", client.Player.Hunted.ToIntString())); hitlist.AddPacketToOthers(client.Player.GetActiveRecruit(), client.Player.Map, TcpPacket.CreatePacket("playerhunted", client.ConnectionID.ToString(), client.Player.Hunted.ToIntString()), Enums.OutdateType.Condition); }
public static void AppendOwnXY(Client client, PacketHitList hitlist) { hitlist.AddPacket(client, CreatePlayerXY(client)); client.Player.RefreshSeenCharacters(hitlist); }
public static void AppendInventory(Client client, PacketHitList hitlist) { TcpPacket packet = new TcpPacket("playerinv"); packet.AppendParameter(client.Player.MaxInv); for (int i = 1; i <= client.Player.MaxInv; i++) { packet.AppendParameters(client.Player.Inventory[i].Num.ToString(), client.Player.Inventory[i].Amount.ToString(), client.Player.Inventory[i].Sticky.ToIntString()); } packet.FinalizePacket(); hitlist.AddPacket(client, packet); }
public void ProcessHunger(PacketHitList hitlist) { if (BellyStepCounter >= 100) { if (GetActiveRecruit().Belly > 20) { GetActiveRecruit().Belly -= (BellyStepCounter / 100); if (GetActiveRecruit().Belly <= 20) { hitlist.AddPacket(client, PacketBuilder.CreateBattleMsg("Getting hungry...", Text.Red)); hitlist.AddPacket(client, PacketBuilder.CreateSoundPacket("magic129.wav")); } PacketBuilder.AppendBelly(client, hitlist); } else if (GetActiveRecruit().Belly > 10) { GetActiveRecruit().Belly -= (BellyStepCounter / 100); if (GetActiveRecruit().Belly <= 10) { hitlist.AddPacket(client, PacketBuilder.CreateBattleMsg("Getting dizzy from hunger...", Text.Red)); hitlist.AddPacket(client, PacketBuilder.CreateSoundPacket("magic129.wav")); } PacketBuilder.AppendBelly(client, hitlist); } else if (GetActiveRecruit().Belly > 0) { GetActiveRecruit().Belly -= (BellyStepCounter / 100); if (GetActiveRecruit().Belly <= 0) { GetActiveRecruit().Belly = 0; hitlist.AddPacket(client, PacketBuilder.CreateBattleMsg("Oh no! Your belly is empty!", Text.Red)); hitlist.AddPacket(client, PacketBuilder.CreateSoundPacket("magic129.wav")); } PacketBuilder.AppendBelly(client, hitlist); } BellyStepCounter = BellyStepCounter % 100; } }
public static void AppendJobList(Client client, PacketHitList hitlist) { // TcpPacket packet = new TcpPacket("joblist"); Player player = client.Player; packet.AppendParameter(player.JobList.JobList.Count.ToString()); for (int i = 0; i < player.JobList.JobList.Count; i++) { WonderMailJob job = player.JobList.JobList[i]; packet.AppendParameters(job.Mission.Title, job.Mission.Summary, job.Mission.GoalName); packet.AppendParameters(WonderMailManager.Missions.MissionPools[(int)job.Mission.Difficulty - 1].MissionClients[job.Mission.MissionClientIndex].Species, WonderMailManager.Missions.MissionPools[(int)job.Mission.Difficulty - 1].MissionClients[job.Mission.MissionClientIndex].Form, (int)job.Mission.MissionType, job.Mission.Data1, job.Mission.Data2, (int)job.Mission.Difficulty, WonderMailManager.Missions.MissionPools[(int)job.Mission.Difficulty - 1].Rewards[job.Mission.RewardIndex].ItemNum, WonderMailManager.Missions.MissionPools[(int)job.Mission.Difficulty - 1].Rewards[job.Mission.RewardIndex].Amount, job.Mission.Mugshot); //MapGeneralInfo mapInfo = MapManager.RetrieveMapGeneralInfo(player.JobList.JobList[i].Mission.Goal); packet.AppendParameters((int)player.JobList.JobList[i].Accepted); if (player.JobList.JobList[i].SendsRemaining > 0) { packet.AppendParameters(1); } else { packet.AppendParameters(0); } } packet.FinalizePacket(); hitlist.AddPacket(client, packet); }
public void AddActivationIfCharacterNotSeen(PacketHitList hitlist, Combat.ICharacter target) { if (target == GetActiveRecruit()) return; SeenCharacter seencharacter; if (target.CharacterType == Enums.CharacterType.Recruit) { bool shouldActivate = false; lock (seenPlayers) { if (!seenPlayers.TryGetValue(((Recruit)target).Owner.Player.CharID, out seencharacter)) { seencharacter = new SeenCharacter(); seenPlayers.Add(((Recruit)target).Owner.Player.CharID, seencharacter); shouldActivate = true; } else { if (!seencharacter.InSight) { shouldActivate = true; } } } if (shouldActivate) { if (seencharacter.LocationOutdated) { //add location data hitlist.AddPacket(client, PacketBuilder.CreatePlayerXY(((Recruit)target).Owner)); hitlist.AddPacket(client, PacketBuilder.CreatePlayerDir(((Recruit)target).Owner)); seencharacter.LocationOutdated = false; } if (seencharacter.ConditionOutdated) { //add condition data hitlist.AddPacket(client, PacketBuilder.CreatePlayerStatusAilment(((Recruit)target).Owner)); //hitlist.AddPacket(client, PacketBuilder.CreatePlayerConfusion(((Recruit)target).Owner)); hitlist.AddPacket(client, PacketBuilder.CreatePlayerVolatileStatus(((Recruit)target).Owner)); seencharacter.ConditionOutdated = false; } //add activation param hitlist.AddPacket(client, PacketBuilder.CreatePlayerActivation(((Recruit)target).Owner, true)); //set isseen to true seencharacter.InSight = true; } } else if (target.CharacterType == Enums.CharacterType.MapNpc) { MapNpc npcTarget = (MapNpc)target; bool shouldActivate = false; lock (seenNpcs) { Dictionary<int, SeenCharacter> mapSeenNpcs = null; if (!seenNpcs.TryGetValue(npcTarget.MapID, out mapSeenNpcs)) { mapSeenNpcs = new Dictionary<int, SeenCharacter>(); seenNpcs.Add(npcTarget.MapID, mapSeenNpcs); shouldActivate = true; } if (!mapSeenNpcs.TryGetValue(npcTarget.MapSlot, out seencharacter)) { seencharacter = new SeenCharacter(); mapSeenNpcs.Add(npcTarget.MapSlot, seencharacter); shouldActivate = true; } else { if (!seencharacter.InSight) { shouldActivate = true; } } } if (shouldActivate) { if (seencharacter.LocationOutdated) { //add location data hitlist.AddPacket(client, PacketBuilder.CreateNpcXY(npcTarget)); hitlist.AddPacket(client, PacketBuilder.CreateNpcDir(npcTarget)); seencharacter.LocationOutdated = false; } if (seencharacter.ConditionOutdated) { //add condition data hitlist.AddPacket(client, PacketBuilder.CreateNpcHP(npcTarget)); hitlist.AddPacket(client, PacketBuilder.CreateNpcStatusAilment(npcTarget)); //hitlist.AddPacket(client, PacketBuilder.CreateNpcConfusion(npcTarget)); hitlist.AddPacket(client, PacketBuilder.CreateNpcVolatileStatus(npcTarget)); seencharacter.ConditionOutdated = false; } //add activation param hitlist.AddPacket(client, PacketBuilder.CreateNpcActivation(npcTarget, true)); //set isseen to true seencharacter.InSight = true; } } }
public static void AppendJoinMap(Client client, PacketHitList hitlist) { client.Player.RecreateSeenCharacters(); // Send all players on current map to client foreach (Client i in ClientManager.GetClients()) { Player player2 = i.Player; if (player2 != null) { if (i.IsPlaying() && i != client && player2.MapID == client.Player.MapID) { i.Player.SeeNewCharacter(client.Player.GetActiveRecruit()); TcpPacket packet = TcpPacket.CreatePacket("playerdata", i.ConnectionID.ToString(), player2.Name, player2.GetActiveRecruit().Sprite.ToString(), player2.GetActiveRecruit().Form.ToString(), ((int)player2.GetActiveRecruit().Shiny).ToString(), ((int)player2.GetActiveRecruit().Sex).ToString(), player2.MapID, player2.X.ToString(), player2.Y.ToString(), ((int)player2.Direction).ToString(), ((int)player2.Access).ToString(), player2.Hunted.ToIntString(), player2.Dead.ToIntString(), player2.GuildName, ((int)player2.GuildAccess).ToString(), player2.Status, "0"); packet.AppendParameters((int)player2.GetActiveRecruit().StatusAilment, player2.GetActiveRecruit().VolatileStatus.Count); for (int j = 0; j < player2.GetActiveRecruit().VolatileStatus.Count; j++) { packet.AppendParameter(player2.GetActiveRecruit().VolatileStatus[j].Emoticon); } hitlist.AddPacket(client, packet); } } } }