public static void DebuffBank(PacketContent pc, ref Bank bankToFill) { for (int i = 0; i < Constants.MAX_BANK; i++) { bankToFill.items[i].id = pc.ReadLong(); bankToFill.items[i].amount = pc.ReadLong(); } }
public static void DebuffPlayer(PacketContent pc, ref Player playerToFill) { playerToFill.PlayerName = pc.ReadUnicode(Constants.PLAYER_NAME_LENGTH); playerToFill.sex = (byte)pc.ReadLong(); playerToFill.playerClass = pc.ReadLong(); playerToFill.sprite = pc.ReadLong(); playerToFill.level = (byte)pc.ReadLong(); playerToFill.exp = pc.ReadLong(); playerToFill.access = pc.ReadByte(); playerToFill.isPK = pc.ReadByte(); pc.readOffset += 2; playerToFill.hair = pc.ReadLong(); playerToFill.eyes = pc.ReadLong(); playerToFill.ryo = pc.ReadLong(); playerToFill.vitals[(int)Vitals.HP] = pc.ReadLong(); playerToFill.vitals[(int)Vitals.MP] = pc.ReadLong(); for (int i = 0; i < (int)Stats.counter; i++) { playerToFill.stats[i] = pc.ReadInteger(); } pc.readOffset += 2; playerToFill.points = pc.ReadLong(); //Inventory for (int i = 0; i < (int)Equipment.counter; i++) { playerToFill.equipment[i] = pc.ReadLong(); } for (int i = 0; i < Constants.MAX_INV; i++) { playerToFill.inventory[i].id = pc.ReadLong(); playerToFill.inventory[i].amount = pc.ReadLong(); } //Spells for (int i = 0; i < Constants.MAX_PLAYER_SPELLS; i++) { playerToFill.spells[i] = pc.ReadLong(); } //Hotbar for (int i = 0; i < Constants.MAX_HOTBAR; i++) { playerToFill.hotbar[i].slot = pc.ReadLong(); playerToFill.hotbar[i].sType = (byte)pc.ReadLong(); } //Map playerToFill.currentMap = pc.ReadLong(); playerToFill.x = pc.ReadByte(); playerToFill.y = pc.ReadByte(); playerToFill.dir = pc.ReadByte(); //Switches for (int i = 0; i < Constants.MAX_SWITCHES; i++) { playerToFill.switches[i] = pc.ReadByte(); } //Variables for (int i = 0; i < Constants.MAX_VARIABLES; i++) { playerToFill.variables[i] = pc.ReadLong(); } //PlayerQuests for (int i = 0; i < Constants.MAX_PLAYER_QUESTS; i++) { playerToFill.quests[i].currentObjective = pc.ReadByte(); playerToFill.quests[i].completed[0] = pc.ReadByte(); playerToFill.quests[i].completed[1] = pc.ReadByte(); playerToFill.quests[i].completed[2] = pc.ReadByte(); playerToFill.quests[i].id = pc.ReadLong(); playerToFill.quests[i].counter[0] = pc.ReadLong(); playerToFill.quests[i].counter[1] = pc.ReadLong(); playerToFill.quests[i].counter[2] = pc.ReadLong(); } //Completed Quest for (int i = 0; i < Constants.MAX_QUESTS; i++) { playerToFill.completedQuest[i] = pc.ReadLong(); } //Guild playerToFill.guild = pc.ReadLong(); playerToFill.minutes = pc.ReadLong(); playerToFill.hours = pc.ReadLong(); playerToFill.attackAnimation = pc.ReadLong(); //Friends for (int i = 0; i < Constants.MAX_PLAYER_FRIENDS; i++) { playerToFill.friends[i].name = pc.ReadUnicode(Constants.PLAYER_NAME_LENGTH); } //Elements for (int i = 0; i < Constants.MAX_ELEMENTS; i++) { playerToFill.elements[i] = pc.ReadByte(); } playerToFill.isMuted = pc.ReadByte(); playerToFill.IsDonor = pc.ReadByte(); pc.readOffset += 1; //HasChar Int16 hasChar = pc.ReadInteger(); playerToFill.HasChar = (hasChar == (-1) ? true : false); }
private static void RegisterServer(PacketContent pc, ServerDetails serverDetails) { appendLog(".::Received server connection::. "); serverDetails.serverIndex = pc.ReadLong(); serverDetails.name = pc.ReadString(); serverDetails.ip = pc.ReadString(); serverDetails.port = pc.ReadLong(); serverDetails.location = pc.ReadString(); serverDetails.donorOnly = pc.ReadFlag(); serverDetails.registered = true; appendLog(".::Name: " + serverDetails.name); appendLog(".::IP: " + serverDetails.ip); appendLog(".::Port: " + serverDetails.port); }
private static void CheckAdmission(PacketContent data) { string loginName = data.ReadString(); GamePlayerAdmission status = (GamePlayerAdmission)data.ReadLong(); switch (status) { case GamePlayerAdmission.Accepted: AllowPlayerToJoinTheServer(loginName); break; case GamePlayerAdmission.Rejected_Multilogin: appendLog("Server has rejected " + loginName + " due to multilogin attempt!"); PlayerClient.PlayerRejected(loginName, "Multiple logins are not authorized."); break; case GamePlayerAdmission.Rejected_TooManyPlayers: appendLog("Server has rejected " + loginName + " due to max players limit!"); PlayerClient.PlayerRejected(loginName, "Theres too many players in game. Please try again later."); break; default: break; } }