public void HandlePacket(GameClient client, GSPacketIn packet) { ushort keepId = packet.ReadShort(); ushort wallId = packet.ReadShort(); int hookpointID = packet.ReadShort(); ushort itemslot = packet.ReadShort(); int payType = packet.ReadByte();//gold RP BP contrat??? int unk2 = packet.ReadByte(); int unk3 = packet.ReadByte(); int unk4 = packet.ReadByte(); // client.Player.Out.SendMessage("x="+unk2+"y="+unk3+"z="+unk4,eChatType.CT_Say,eChatLoc.CL_SystemWindow); AbstractGameKeep keep = GameServer.KeepManager.GetKeepByID(keepId); if (keep == null) return; GameKeepComponent component = keep.KeepComponents[wallId] as GameKeepComponent; if (component == null) return; /*GameKeepHookPoint hookpoint = component.HookPoints[hookpointID] as GameKeepHookPoint; if (hookpoint == null) return 1; */ HookPointInventory inventory = null; if(hookpointID > 0x80) inventory = HookPointInventory.YellowHPInventory; //oil else if(hookpointID > 0x60) inventory = HookPointInventory.GreenHPInventory;//big siege else if(hookpointID > 0x40) inventory = HookPointInventory.LightGreenHPInventory; //small siege else if (hookpointID > 0x20) inventory = HookPointInventory.BlueHPInventory;//npc else inventory = HookPointInventory.RedHPInventory;//guard if (inventory != null) { HookPointItem item = inventory.GetItem(itemslot); if (item != null) item.Invoke(client.Player, payType, component.HookPoints[hookpointID] as GameKeepHookPoint, component); } }
public int HandlePacket(GameClient client, GSPacketIn packet) { GSPacketIn gSPacketIn = new GSPacketIn(69, client.Player.PlayerCharacter.ID); byte b = packet.ReadByte(); byte b2 = packet.ReadByte(); GamePlayer[] allPlayersNoGame = WorldMgr.GetAllPlayersNoGame(); int num = allPlayersNoGame.Length; byte b3 = (num > (int)b2) ? b2 : ((byte)num); gSPacketIn.WriteByte(b3); for (int i = (int)(b * b2); i < (int)(b * b2 + b3); i++) { PlayerInfo playerCharacter = allPlayersNoGame[i % num].PlayerCharacter; gSPacketIn.WriteInt(playerCharacter.ID); gSPacketIn.WriteString(playerCharacter.NickName); gSPacketIn.WriteByte(playerCharacter.typeVIP); gSPacketIn.WriteInt(playerCharacter.VIPLevel); gSPacketIn.WriteBoolean(playerCharacter.Sex); gSPacketIn.WriteInt(playerCharacter.Grade); gSPacketIn.WriteInt(playerCharacter.ConsortiaID); gSPacketIn.WriteString(playerCharacter.ConsortiaName); gSPacketIn.WriteInt(playerCharacter.Offer); gSPacketIn.WriteInt(playerCharacter.Win); gSPacketIn.WriteInt(playerCharacter.Total); gSPacketIn.WriteInt(playerCharacter.Escape); gSPacketIn.WriteInt(playerCharacter.Repute); gSPacketIn.WriteInt(playerCharacter.FightPower); gSPacketIn.WriteBoolean(playerCharacter.IsOldPlayer); } client.Out.SendTCP(gSPacketIn); return(0); }
public void HandlePacket(GameClient client, GSPacketIn packet) { packet.ReadShort(); // unk int action = packet.ReadByte(); int ammo = packet.ReadByte(); // (ammo type if command = 'select ammo' ?) if (client.Player.SiegeWeapon == null) { return; } if (client.Player.IsStealthed) { client.Out.SendMessage("You can't control a siege weapon while hidden!", eChatType.CT_System, eChatLoc.CL_SystemWindow); return; } if (client.Player.IsSitting) { client.Out.SendMessage("You can't fire a siege weapon while sitting!", eChatType.CT_System, eChatLoc.CL_SystemWindow); return; } if (!client.Player.IsAlive || client.Player.IsMezzed || client.Player.IsStunned) { client.Out.SendMessage("You can't control a siege weapon now!", eChatType.CT_System, eChatLoc.CL_SystemWindow); return; } if (!client.Player.IsWithinRadius(client.Player.SiegeWeapon, GameSiegeWeapon.SIEGE_WEAPON_CONTROLE_DISTANCE)) { client.Out.SendMessage(client.Player.SiegeWeapon.GetName(0, true) + " is too far away for you to control!", eChatType.CT_System, eChatLoc.CL_SystemWindow); return; } switch (action) { case 1: { client.Player.SiegeWeapon.Load(ammo); } break; //select ammo need Log to know how sent case 2: { client.Player.SiegeWeapon.Arm(); } break; //arm case 3: { client.Player.SiegeWeapon.Aim(); } break; //aim case 4: { client.Player.SiegeWeapon.Fire(); } break; //fire case 5: { client.Player.SiegeWeapon.Move(); } break; //move case 6: { client.Player.SiegeWeapon.Repair(); } break; //repair case 7: { client.Player.SiegeWeapon.salvage(); } break; //salvage case 8: { client.Player.SiegeWeapon.ReleaseControl(); } break; //release case 9: { client.Player.SiegeWeapon.StopMove(); } break; //stop case 10: { client.Player.SiegeWeapon.Fire(); } break; //swing default: { client.Player.Out.SendMessage("Unhandled action ID: " + action, eChatType.CT_System, eChatLoc.CL_SystemWindow); break; } } }
public void HandleCommand(BaseGame game, Player player, GSPacketIn packet) { if (player.IsAttacking) { GSPacketIn pkg = packet.Clone(); pkg.ClientID = player.PlayerDetail.PlayerCharacter.ID; pkg.Parameter1 = player.Id; game.SendToAll(pkg, player.PlayerDetail); byte type = packet.ReadByte(); int tx = packet.ReadInt(); int ty = packet.ReadInt(); byte dir = packet.ReadByte(); bool isLiving = packet.ReadBoolean(); switch (type) { case 0: case 1: player.SetXY(tx, ty); player.StartFalling(true); if (player.Y - ty > 1 || player.IsLiving != isLiving) { game.SendPlayerMove(player, 3, player.X, player.Y, 0, player.IsLiving, null); } break; } } }
public void HandlePacket(GameClient client, GSPacketIn packet) { // for 1.115c+ The First client packet Changes. if (client.Version < GameClient.eClientVersion.Version1115) { int rc4 = packet.ReadByte(); byte clientType = (byte)packet.ReadByte(); client.ClientType = (GameClient.eClientType)(clientType & 0x0F); client.ClientAddons = (GameClient.eClientAddons)(clientType & 0xF0); client.MajorBuild = (byte)packet.ReadByte(); client.MinorBuild = (byte)packet.ReadByte(); client.MinorRev = packet.ReadString(1); if (rc4 == 1) { //DOLConsole.Log("SBox=\n"); //DOLConsole.LogDump(client.PacketProcessor.Encoding.SBox); packet.Read(client.PacketProcessor.Encoding.SBox, 0, 256); client.PacketProcessor.Encoding.EncryptionState = eEncryptionState.PseudoRC4Encrypted; //DOLConsole.WriteLine(client.Socket.RemoteEndPoint.ToString()+": SBox set!"); //DOLConsole.Log("SBox=\n"); //DOLConsole.LogDump(((PacketEncoding168)client.PacketProcessor.Encoding).SBox); } else { //Send the crypt key to the client client.Out.SendVersionAndCryptKey(); } } else { // if the DataSize is above 7 then the RC4 key is bundled if (packet.DataSize > 7) { if (Properties.CLIENT_ENABLE_ENCRYPTION_RC4) { var length = packet.ReadIntLowEndian(); var key = new byte[length]; packet.Read(key, 0, (int)length); client.PacketProcessor.Encoding.SBox = key; client.PacketProcessor.Encoding.EncryptionState = eEncryptionState.PseudoRC4Encrypted; } return; } // register client type byte clientType = (byte)packet.ReadByte(); client.ClientType = (GameClient.eClientType)(clientType & 0x0F); client.ClientAddons = (GameClient.eClientAddons)(clientType & 0xF0); // the next 4 bytes are the game.dll version but not in string form // ie: 01 01 19 61 = 1.125a // this version is handled elsewhere before being sent here. packet.Skip(3); // skip the numbers in the version client.MinorRev = packet.ReadString(1); // get the minor revision letter // 1125d support packet.Skip(2); // build //Send the crypt key to the client client.Out.SendVersionAndCryptKey(); } }
public void HandlePacket(GameClient client, GSPacketIn packet) { if (client.Player == null) return; int slot = packet.ReadByte(); int unk1 = packet.ReadByte(); ushort unk2 = packet.ReadShort(); uint price = packet.ReadInt(); GameConsignmentMerchant con = client.Player.ActiveConMerchant; House house = HouseMgr.GetHouse(con.HouseNumber); if (house == null) return; if (!house.HasOwnerPermissions(client.Player)) return; int dbSlot = (int)eInventorySlot.Consignment_First + slot; InventoryItem item = GameServer.Database.SelectObject<InventoryItem>("OwnerID = '" + client.Player.DBCharacter.ObjectId + "' AND SlotPosition = '" + dbSlot.ToString() + "'"); if (item != null) { item.SellPrice = (int)price; GameServer.Database.SaveObject(item); } else { client.Player.TempProperties.setProperty(NEW_PRICE, (int)price); } // another update required here,currently the player needs to reopen the window to see the price, thats why we msg him client.Out.SendMessage("New price set! (open the merchant window again to see the price)", eChatType.CT_System, eChatLoc.CL_SystemWindow); }
private void HandlePlayerConsortiaFight(GSPacketIn pkg) { GamePlayer playerById = WorldMgr.GetPlayerById(pkg.ClientID); Dictionary <int, Player> dictionary = new Dictionary <int, Player>(); int consortiaWin = pkg.ReadInt(); int consortiaLose = pkg.ReadInt(); int num = pkg.ReadInt(); for (int i = 0; i < num; i++) { GamePlayer playerById2 = WorldMgr.GetPlayerById(pkg.ReadInt()); if (playerById2 != null) { Player value = new Player(playerById2, 0, null, 0, playerById2.PlayerCharacter.hp); dictionary.Add(i, value); } } eRoomType roomType = (eRoomType)pkg.ReadByte(); eGameType gameClass = (eGameType)pkg.ReadByte(); int totalKillHealth = pkg.ReadInt(); if (playerById != null) { int num2 = playerById.ConsortiaFight(consortiaWin, consortiaLose, dictionary, roomType, gameClass, totalKillHealth, num); } }
public void HandlePacket(GameClient client, GSPacketIn packet) { int unk1 = packet.ReadByte(); int unk2 = packet.ReadByte(); ushort houseNumber = packet.ReadShort(); // house is null, return var house = HouseMgr.GetHouse(houseNumber); if (house == null) { return; } // player is null, return if (client.Player == null) { return; } // player has no owner permissions and isn't a GM or admin, return if (!house.HasOwnerPermissions(client.Player) && client.Account.PrivLevel <= 1) { return; } // build the packet client.Out.SendHouseUsersPermissions(house); }
public void HandleCommand(BaseGame game, Player player, GSPacketIn packet) { if (player.IsAttacking) { byte b = packet.ReadByte(); int x = packet.ReadInt(); int num = packet.ReadInt(); byte dir = packet.ReadByte(); bool flag = packet.ReadBoolean(); short num2 = packet.ReadShort(); int arg_40_0 = game.TurnIndex; switch (b) { case 0: case 1: player.SetXY(x, num); player.StartMoving(); if (player.Y - num > 1 || player.IsLiving != flag) { game.SendPlayerMove(player, 3, player.X, player.Y, dir); } break; default: return; } } }
private void HandlePlayerConsortiaFight(GSPacketIn pkg) { GamePlayer player = WorldMgr.GetPlayerById(pkg.ClientID); Dictionary <int, Player> players = new Dictionary <int, Player>(); int consortiaWin = pkg.ReadInt(); int consortiaLose = pkg.ReadInt(); int count = pkg.ReadInt(); int offer = 0; for (int i = 0; i < count; i++) { GamePlayer Temp = WorldMgr.GetPlayerById(pkg.ReadInt()); if (Temp != null) { Player Tempplayer = new Player(Temp, 0, null, 0); players.Add(i, Tempplayer); } } eRoomType roomtype = (eRoomType)pkg.ReadByte(); eGameType gametype = (eGameType)pkg.ReadByte(); int totalKillHealth = pkg.ReadInt(); if (player != null) { offer = player.ConsortiaFight(consortiaWin, consortiaLose, players, roomtype, gametype, totalKillHealth, count); } if (offer != 0) { } }
public void HandlePacket(GameClient client, GSPacketIn packet) { ushort playerID = packet.ReadShort(); // no use for that. // house is null, return var house = client.Player.CurrentHouse; if(house == null) return; // grab all valid changes var changes = new List<int>(); for (int i = 0; i < 10; i++) { int swtch = packet.ReadByte(); int change = packet.ReadByte(); if (swtch != 255) { changes.Add(change); } } // apply changes if (changes.Count > 0) { house.Edit(client.Player, changes); } }
public void HandlePacket(GameClient client, GSPacketIn packet) { var response = (byte)packet.ReadByte(); if (response != 1) // confirm { return; } var countChosen = (byte)packet.ReadByte(); var itemsChosen = new int[8]; for (int i = 0; i < 8; ++i) { itemsChosen[i] = packet.ReadByte(); } packet.ReadShort(); // unknown packet.ReadShort(); // unknown packet.ReadShort(); // unknown ushort questId = packet.ReadShort(); ushort questGiverId = packet.ReadShort(); new QuestRewardChosenAction(client.Player, countChosen, itemsChosen, questGiverId, questId).Start(1); }
public void HandlePacket(GameClient client, GSPacketIn packet) { int rc4 = packet.ReadByte(); byte clientType = (byte)packet.ReadByte(); client.ClientType = (GameClient.eClientType)(clientType & 0x0F); client.ClientAddons = (GameClient.eClientAddons)(clientType & 0xF0); byte major = (byte)packet.ReadByte(); byte minor = (byte)packet.ReadByte(); byte build = (byte)packet.ReadByte(); if(rc4==1) { //DOLConsole.Log("SBox=\n"); //DOLConsole.LogDump(client.PacketProcessor.Encoding.SBox); packet.Read(((PacketEncoding168)client.PacketProcessor.Encoding).SBox,0,256); ((PacketEncoding168)client.PacketProcessor.Encoding).EncryptionState=PacketEncoding168.eEncryptionState.PseudoRC4Encrypted; //DOLConsole.WriteLine(client.Socket.RemoteEndPoint.ToString()+": SBox set!"); //DOLConsole.Log("SBox=\n"); //DOLConsole.LogDump(((PacketEncoding168)client.PacketProcessor.Encoding).SBox); } else { //Send the crypt key to the client client.Out.SendVersionAndCryptKey(); } }
public override int HandlePacket(GamePlayer player, GSPacketIn packet) { GSPacketIn pkg = packet.Clone(); pkg.ClearContext(); byte page = packet.ReadByte(); byte count = packet.ReadByte(); GamePlayer[] players = WorldMgr.GetAllPlayersNoGame(); int total = players.Length; byte length = (total > (int)count) ? count : ((byte)total); pkg.WriteByte(length); for (int i = (int)(page * count); i < (int)(page * count + length); i++) { PlayerInfo info = players[i % total].PlayerCharacter; pkg.WriteInt(info.ID); pkg.WriteString((info.NickName == null) ? "" : info.NickName); pkg.WriteBoolean(info.Sex); pkg.WriteInt(info.Grade); pkg.WriteInt(info.ConsortiaID); pkg.WriteString((info.ConsortiaName == null) ? "" : info.ConsortiaName); pkg.WriteInt(info.Offer); pkg.WriteInt(info.Win); pkg.WriteInt(info.Total); pkg.WriteInt(info.Escape); pkg.WriteInt(info.Repute); pkg.WriteInt(info.FightPower); } player.Out.SendTCP(pkg); return(0); }
public void HandlePacket(GameClient client, GSPacketIn packet) { int flagSpeedData = packet.ReadShort(); int heading = packet.ReadShort(); if (client.Version > GameClient.eClientVersion.Version171) { int xOffsetInZone = packet.ReadShort(); int yOffsetInZone = packet.ReadShort(); int currentZoneID = packet.ReadShort(); int realZ = packet.ReadShort(); Zone newZone = WorldMgr.GetZone((ushort) currentZoneID); if (newZone == null) { if (Log.IsWarnEnabled) Log.Warn("Unknown zone in UseSpellHandler: " + currentZoneID + " player: " + client.Player.Name); } else { client.Player.X = newZone.XOffset + xOffsetInZone; client.Player.Y = newZone.YOffset + yOffsetInZone; client.Player.Z = realZ; client.Player.MovementStartTick = Environment.TickCount; } } int spellLevel = packet.ReadByte(); int spellLineIndex = packet.ReadByte(); client.Player.Heading = (ushort) (heading & 0xfff); new UseSpellAction(client.Player, flagSpeedData, spellLevel, spellLineIndex).Start(1); }
public void HandlePacket(GameClient client, GSPacketIn packet) { packet.ReadShort(); // playerId no use for that. // house is null, return var house = client.Player.CurrentHouse; if (house == null) { return; } // grab all valid changes var changes = new List <int>(); for (int i = 0; i < 10; i++) { int swtch = packet.ReadByte(); int change = packet.ReadByte(); if (swtch != 255) { changes.Add(change); } } // apply changes if (changes.Count > 0) { house.Edit(client.Player, changes); } }
public void HandlePacket(GameClient client, GSPacketIn packet) { var aggroState = (byte)packet.ReadByte(); // 1-Aggressive, 2-Deffensive, 3-Passive var walkState = (byte)packet.ReadByte(); // 1-Follow, 2-Stay, 3-GoTarg, 4-Here var command = (byte)packet.ReadByte(); // 1-Attack, 2-Release //[Ganrod] Nidel: Animist can removed his TurretFnF without MainPet. if (client.Player.TargetObject != null && command == 2 && client.Player.ControlledBrain == null && client.Player.CharacterClass.ID == (int)eCharacterClass.Animist) { var turret = client.Player.TargetObject as TurretPet; if (turret != null && turret.Brain is TurretFNFBrain && client.Player.IsControlledNPC(turret)) { //release new HandlePetCommandAction(client.Player, 0, 0, 2).Start(1); return; } } //[Ganrod] Nidel: Call only if player has controllednpc if (client.Player.ControlledBrain != null) { new HandlePetCommandAction(client.Player, aggroState, walkState, command).Start(1); return; } }
public int HandlePacket(GameClient client, GSPacketIn packet) { if (client.Player.CurrentRoom != null && client.Player == client.Player.CurrentRoom.Host && !client.Player.CurrentRoom.IsPlaying) { //string name = packet.ReadString(); //string pwd = packet.ReadString(); int mapId = packet.ReadInt(); if (mapId == 10000) { return(0); } byte rT = packet.ReadByte(); eRoomType roomType; if (rT == 10) { roomType = eRoomType.Exploration; } else { roomType = (eRoomType)rT; } byte timeType = packet.ReadByte(); byte hardLevel = packet.ReadByte(); int levelLimits = packet.ReadInt(); //eRoomType roomType = (eRoomType)packet.ReadByte(); //eTeamType teamType = (eTeamType)packet.ReadByte(); RoomMgr.UpdateRoomGameType(client.Player.CurrentRoom, packet, roomType, timeType, (eHardLevel)hardLevel, levelLimits, mapId); //RoomMgr.StartGame(client.Player.CurrentRoom); } return(0); }
public void HandlePacket(GameClient client, GSPacketIn packet) { int permissionSlot = packet.ReadByte(); int newPermissionLevel = packet.ReadByte(); ushort houseNumber = packet.ReadShort(); // house is null, return var house = HouseMgr.GetHouse(houseNumber); if (house == null) return; // player is null, return if (client.Player == null) return; // can't set permissions unless you're the owner. if (!house.HasOwnerPermissions(client.Player) && client.Account.PrivLevel <= 1) return; // check if we're setting or removing permissions if (newPermissionLevel == 100) { house.RemovePermission(permissionSlot); } else { house.AdjustPermissionSlot(permissionSlot, newPermissionLevel); } }
public void HandlePacket(GameClient client, GSPacketIn packet) { ushort housenumber = packet.ReadShort(); var index = (byte) packet.ReadByte(); var unk1 = (byte) packet.ReadByte(); // house is null, return var house = HouseMgr.GetHouse(housenumber); if (house == null) return; // player is null, return if (client.Player == null) return; // rotation only works for inside items if (!client.Player.InHouse) return; // no permission to change the interior, return if (!house.CanChangeInterior(client.Player, DecorationPermissions.Add)) return; var pak = new GSTCPPacketOut(client.Out.GetPacketCode(eServerPackets.HouseDecorationRotate)); pak.WriteShort(housenumber); pak.WriteByte(index); pak.WriteByte(0x01); client.Out.SendTCP(pak); }
public void HandlePacket(GameClient client, GSPacketIn packet) { var aggroState = (byte) packet.ReadByte(); // 1-Aggressive, 2-Deffensive, 3-Passive var walkState = (byte) packet.ReadByte(); // 1-Follow, 2-Stay, 3-GoTarg, 4-Here var command = (byte) packet.ReadByte(); // 1-Attack, 2-Release //[Ganrod] Nidel: Animist can removed his TurretFnF without MainPet. if (client.Player.TargetObject != null && command == 2 && client.Player.ControlledBrain == null && client.Player.CharacterClass.ID == (int) eCharacterClass.Animist) { var turret = client.Player.TargetObject as TurretPet; if (turret != null && turret.Brain is TurretFNFBrain && client.Player.IsControlledNPC(turret)) { //release new HandlePetCommandAction(client.Player, 0, 0, 2).Start(1); return; } } //[Ganrod] Nidel: Call only if player has controllednpc if (client.Player.ControlledBrain != null) { new HandlePetCommandAction(client.Player, aggroState, walkState, command).Start(1); return; } }
public void HandlePacket(GameClient client, GSPacketIn packet) { if (client.Player.Guild == null) { return; } if (!client.Player.Guild.HasRank(client.Player, Guild.eRank.Leader)) { return; } int primarycolor = packet.ReadByte() & 0x0F; // 4bits int secondarycolor = packet.ReadByte() & 0x07; // 3bits int pattern = packet.ReadByte() & 0x03; // 2bits int logo = packet.ReadByte(); // 8bits int oldemblem = client.Player.Guild.Emblem; int newemblem = (logo << 9) | (pattern << 7) | (primarycolor << 3) | secondarycolor; if (GuildMgr.IsEmblemUsed(newemblem)) { client.Player.Out.SendMessage("This emblem is already in use by another guild, please choose another!", eChatType.CT_System, eChatLoc.CL_SystemWindow); return; } GuildMgr.ChangeEmblem(client.Player, oldemblem, newemblem); }
public void HandlePacket(GameClient client, GSPacketIn packet) { int unk1 = packet.ReadByte(); int position = packet.ReadByte(); ushort housenumber = packet.ReadShort(); ushort angle = packet.ReadShort(); ushort unk2 = packet.ReadShort(); // rotation only works for inside items if (!client.Player.InHouse) return; // house is null, return var house = HouseMgr.GetHouse(housenumber); if (house == null) return; // player is null, return if (client.Player == null) return; // no permission to change the interior, return if (!house.CanChangeInterior(client.Player, DecorationPermissions.Add)) return; if (house.IndoorItems.ContainsKey(position) == false) return; // grab the item in question IndoorItem iitem = house.IndoorItems[position]; if (iitem == null) { client.Player.Out.SendMessage("error: id was null", eChatType.CT_Help, eChatLoc.CL_SystemWindow); return; } //should this ever happen? // adjust the item's roation int old = iitem.Rotation; iitem.Rotation = (iitem.Rotation + angle)%360; if (iitem.Rotation < 0) { iitem.Rotation = 360 + iitem.Rotation; } iitem.DatabaseItem.Rotation = iitem.Rotation; // save item GameServer.Database.SaveObject(iitem.DatabaseItem); ChatUtil.SendSystemMessage(client, string.Format("Interior decoration rotated from {0} degrees to {1}", old, iitem.Rotation)); // update all players in the house. foreach (GamePlayer plr in house.GetAllPlayersInHouse()) { plr.Client.Out.SendFurniture(house, position); } }
public void HandlePacket(GameClient client, GSPacketIn packet) { byte isok = (byte)packet.ReadByte(); byte repair = (byte)packet.ReadByte(); byte combine = (byte)packet.ReadByte(); packet.ReadByte(); //unknow ITradeWindow trade = client.Player.TradeWindow; if (trade == null) { return; } if (isok == 0) { trade.CloseTrade(); } else if (isok == 1) { if (trade.Repairing != (repair == 1)) { trade.Repairing = (repair == 1); } if (trade.Combine != (combine == 1)) { trade.Combine = (combine == 1); } ArrayList tradeSlots = new ArrayList(10); for (int i = 0; i < 10; i++) { int slotPosition = packet.ReadByte(); InventoryItem item = client.Player.Inventory.GetItem((eInventorySlot)slotPosition); if (item != null && ((item.IsDropable && item.IsTradable) || (client.Player.CanTradeAnyItem || client.Player.TradeWindow.Partner.CanTradeAnyItem))) { tradeSlots.Add(item); } } trade.TradeItems = tradeSlots; packet.ReadShort(); int[] tradeMoney = new int[5]; for (int i = 0; i < 5; i++) { tradeMoney[i] = packet.ReadShort(); } long money = Money.GetMoney(tradeMoney[0], tradeMoney[1], tradeMoney[2], tradeMoney[3], tradeMoney[4]); trade.TradeMoney = money; trade.TradeUpdate(); } else if (isok == 2) { trade.AcceptTrade(); } }
public void HandlePacket(GameClient client, GSPacketIn packet) { var mode = (byte) packet.ReadByte(); bool userAction = packet.ReadByte() == 0; // set to 0 if user pressed the button, set to 1 if client decided to stop attack new AttackRequestHandler(client.Player, mode != 0, userAction).Start(1); }
public void HandlePacket(GameClient client, GSPacketIn packet) { var mode = (byte)packet.ReadByte(); bool userAction = packet.ReadByte() == 0; // set to 0 if user pressed the button, set to 1 if client decided to stop attack new AttackRequestHandler(client.Player, mode != 0, userAction).Start(1); }
public void HandlePacket(GameClient client, GSPacketIn packet) { int flagSpeedData = packet.ReadShort(); int index = packet.ReadByte(); int type = packet.ReadByte(); new UseSkillAction(client.Player, flagSpeedData, index, type).Start(1); }
public void HandlePacket(GameClient client, GSPacketIn packet) { int flagSpeedData = packet.ReadShort(); int slot = packet.ReadByte(); int type = packet.ReadByte(); new UseSlotAction(client.Player, flagSpeedData, slot, type).Start(1); }
public void HandlePacket(GameClient client, GSPacketIn packet) { ushort keepId = packet.ReadShort(); ushort wallId = packet.ReadShort(); int hookpointID = packet.ReadShort(); ushort itemslot = packet.ReadShort(); int payType = packet.ReadByte(); //gold RP BP contrat??? int unk2 = packet.ReadByte(); int unk3 = packet.ReadByte(); int unk4 = packet.ReadByte(); // client.Player.Out.SendMessage("x="+unk2+"y="+unk3+"z="+unk4,eChatType.CT_Say,eChatLoc.CL_SystemWindow); AbstractGameKeep keep = GameServer.KeepManager.GetKeepByID(keepId); if (keep == null) { return; } GameKeepComponent component = keep.KeepComponents[wallId] as GameKeepComponent; if (component == null) { return; } /*GameKeepHookPoint hookpoint = component.HookPoints[hookpointID] as GameKeepHookPoint; * if (hookpoint == null) return 1; */ HookPointInventory inventory = null; if (hookpointID > 0x80) { inventory = HookPointInventory.YellowHPInventory; //oil } else if (hookpointID > 0x60) { inventory = HookPointInventory.GreenHPInventory; //big siege } else if (hookpointID > 0x40) { inventory = HookPointInventory.LightGreenHPInventory; //small siege } else if (hookpointID > 0x20) { inventory = HookPointInventory.BlueHPInventory; //npc } else { inventory = HookPointInventory.RedHPInventory; //guard } if (inventory != null) { HookPointItem item = inventory.GetItem(itemslot); if (item != null) { item.Invoke(client.Player, payType, component.KeepHookPoints[hookpointID] as GameKeepHookPoint, component); } } }
public override int HandlePacket(GamePlayer player, GSPacketIn packet) { byte roomType = packet.ReadByte(); byte timeType = packet.ReadByte(); string room = packet.ReadString(); string pwd = packet.ReadString(); RoomMgr.CreateRoom(player, room, pwd, (eRoomType)roomType, timeType); return(1); }
public void HandlePacket(GameClient client, GSPacketIn packet) { ushort data1 = packet.ReadShort(); ushort data2 = packet.ReadShort(); ushort data3 = packet.ReadShort(); var messageType = (byte) packet.ReadByte(); var response = (byte) packet.ReadByte(); new DialogBoxResponseAction(client.Player, data1, data2, data3, messageType, response).Start(1); }
public void HandlePacket(GameClient client, GSPacketIn packet) { ushort data1 = packet.ReadShort(); ushort data2 = packet.ReadShort(); ushort data3 = packet.ReadShort(); var messageType = (byte)packet.ReadByte(); var response = (byte)packet.ReadByte(); new DialogBoxResponseAction(client.Player, data1, data2, data3, messageType, response).Start(1); }
public int HandlePacket(GameClient client, GSPacketIn packet) { byte roomType = packet.ReadByte(); byte timeType = packet.ReadByte(); string room = packet.ReadString(); string pwd = packet.ReadString(); RoomMgr.CreateRoom(client.Player, room, pwd, (eRoomType)roomType, timeType); return(1); }
public void HandlePacket(GameClient client, GSPacketIn packet) { if (client == null || client.Player == null) return; if ((client.Player.TargetObject is IGameInventoryObject) == false) return; MarketSearch.SearchData search = new MarketSearch.SearchData(); search.name = packet.ReadString(64); search.slot = (int)packet.ReadInt(); search.skill = (int)packet.ReadInt(); search.resist = (int)packet.ReadInt(); search.bonus = (int)packet.ReadInt(); search.hp = (int)packet.ReadInt(); search.power = (int)packet.ReadInt(); search.proc = (int)packet.ReadInt(); search.qtyMin = (int)packet.ReadInt(); search.qtyMax = (int)packet.ReadInt(); search.levelMin = (int)packet.ReadInt(); search.levelMax = (int)packet.ReadInt(); search.priceMin = (int)packet.ReadInt(); search.priceMax = (int)packet.ReadInt(); search.visual = (int)packet.ReadInt(); search.page = (byte)packet.ReadByte(); byte unk1 = (byte)packet.ReadByte(); short unk2 = (short)packet.ReadShort(); byte unk3 = 0; byte unk4 = 0; byte unk5 = 0; byte unk6 = 0; byte unk7 = 0; byte unk8 = 0; if (client.Version >= GameClient.eClientVersion.Version198) { // Dunnerholl 2009-07-28 Version 1.98 introduced new options to Market search. 12 Bytes were added, but only 7 are in usage so far in my findings. // update this, when packets change and keep in mind, that this code reflects only the 1.98 changes search.armorType = search.page; // page is now used for the armorType (still has to be logged, i just checked that 2 means leather, 0 = standard search.damageType = (byte)packet.ReadByte(); // 1=crush, 2=slash, 3=thrust unk3 = (byte)packet.ReadByte(); unk4 = (byte)packet.ReadByte(); unk5 = (byte)packet.ReadByte(); search.playerCrafted = (byte)packet.ReadByte(); // 1 = show only Player crafted, 0 = all // 3 bytes unused packet.Skip(3); search.page = (byte)packet.ReadByte(); // page is now sent here unk6 = (byte)packet.ReadByte(); unk7 = (byte)packet.ReadByte(); unk8 = (byte)packet.ReadByte(); } search.clientVersion = client.Version.ToString(); (client.Player.TargetObject as IGameInventoryObject).SearchInventory(client.Player, search); }
public void HandlePacket(GameClient client, GSPacketIn packet) { int flagSpeedData; int spellLevel; int spellLineIndex; if (client.Version >= GameClient.eClientVersion.Version1124) { client.Player.X = (int)packet.ReadFloatLowEndian(); client.Player.Y = (int)packet.ReadFloatLowEndian(); client.Player.Z = (int)packet.ReadFloatLowEndian(); client.Player.CurrentSpeed = (short)packet.ReadFloatLowEndian(); client.Player.Heading = packet.ReadShort(); flagSpeedData = packet.ReadShort(); // target visible ? 0xA000 : 0x0000 spellLevel = packet.ReadByte(); spellLineIndex = packet.ReadByte(); // two bytes at end, not sure what for } else { flagSpeedData = packet.ReadShort(); int heading = packet.ReadShort(); if (client.Version > GameClient.eClientVersion.Version171) { int xOffsetInZone = packet.ReadShort(); int yOffsetInZone = packet.ReadShort(); int currentZoneID = packet.ReadShort(); int realZ = packet.ReadShort(); Zone newZone = WorldMgr.GetZone((ushort)currentZoneID); if (newZone == null) { Log.Warn($"Unknown zone in UseSpellHandler: {currentZoneID} player: {client.Player.Name}"); } else { client.Player.X = newZone.XOffset + xOffsetInZone; client.Player.Y = newZone.YOffset + yOffsetInZone; client.Player.Z = realZ; client.Player.MovementStartTick = Environment.TickCount; } } spellLevel = packet.ReadByte(); spellLineIndex = packet.ReadByte(); client.Player.Heading = (ushort)(heading & 0xfff); } new UseSpellAction(client.Player, flagSpeedData, spellLevel, spellLineIndex).Start(1); }
public void HandlePacket(GameClient client, GSPacketIn packet) { ushort keepId = packet.ReadShort(); ushort wallId = packet.ReadShort(); int hookpointID = packet.ReadShort(); ushort itemslot = packet.ReadShort(); int payType = packet.ReadByte(); //gold RP BP contrat??? packet.ReadByte(); packet.ReadByte(); packet.ReadByte(); AbstractGameKeep keep = GameServer.KeepManager.GetKeepByID(keepId); if (keep == null) { return; } GameKeepComponent component = keep.KeepComponents[wallId] as GameKeepComponent; if (component == null) { return; } HookPointInventory inventory = null; if (hookpointID > 0x80) { inventory = HookPointInventory.YellowHPInventory; // oil } else if (hookpointID > 0x60) { inventory = HookPointInventory.GreenHPInventory; // big siege } else if (hookpointID > 0x40) { inventory = HookPointInventory.LightGreenHPInventory; // small siege } else if (hookpointID > 0x20) { inventory = HookPointInventory.BlueHPInventory; // npc } else { inventory = HookPointInventory.RedHPInventory; // guard } HookPointItem item = inventory?.GetItem(itemslot); item?.Invoke(client.Player, payType, component.HookPoints[hookpointID], component); }
public void HandlePacket(GameClient client, GSPacketIn packet) { client.Player.X = (int)packet.ReadFloatLowEndian(); client.Player.Y = (int)packet.ReadFloatLowEndian(); client.Player.Z = (int)packet.ReadFloatLowEndian(); client.Player.CurrentSpeed = (short)packet.ReadFloatLowEndian(); client.Player.Heading = packet.ReadShort(); ushort flags = packet.ReadShort(); // target visible ? 0xA000 : 0x0000 int slot = packet.ReadByte(); int type = packet.ReadByte(); new UseSlotAction1124(client.Player, flags, slot, type).Start(1); }
public void HandlePacket(GameClient client, GSPacketIn packet) { if (client.Player == null) { return; } packet.ReadInt(); // X packet.ReadInt(); // Y packet.ReadShort(); // id ushort itemSlot = packet.ReadShort(); byte itemCount = (byte)packet.ReadByte(); byte menuId = (byte)packet.ReadByte(); switch ((eMerchantWindowType)menuId) { case eMerchantWindowType.HousingInsideShop: case eMerchantWindowType.HousingOutsideShop: case eMerchantWindowType.HousingBindstoneHookpoint: case eMerchantWindowType.HousingCraftingHookpoint: case eMerchantWindowType.HousingNPCHookpoint: case eMerchantWindowType.HousingVaultHookpoint: case eMerchantWindowType.HousingDeedMenu: { HouseMgr.BuyHousingItem(client.Player, itemSlot, itemCount, (eMerchantWindowType)menuId); break; } default: { if (client.Player.TargetObject == null) { return; } // Forward the buy process to the merchant if (client.Player.TargetObject is GameMerchant merchant) { // Let merchant choose what happens merchant.OnPlayerBuy(client.Player, itemSlot, itemCount); } else { (client.Player.TargetObject as GameLotMarker)?.OnPlayerBuy(client.Player, itemSlot, itemCount); } break; } } }
public ItemInfo(ref GSPacketIn pkg, bool isNullable) { if (isNullable) { if (pkg.ReadBoolean() == false) { isNull = true; return; } } else { BagType = pkg.ReadByte(); //bagtype } UserID = pkg.ReadInt(); // uid ItemID = pkg.ReadInt(); // item id Count = pkg.ReadInt(); // count Place = pkg.ReadInt(); // place TemplateID = pkg.ReadInt(); //TemplateID AttackCompose = pkg.ReadInt(); //Attack DefendCompose = pkg.ReadInt(); //Defence AgilityCompose = pkg.ReadInt(); //agi LuckCompose = pkg.ReadInt(); //Luck StrengthenLevel = pkg.ReadInt(); //StrengthenLevel IsBinds = pkg.ReadBoolean(); //IsBinds IsJudge = pkg.ReadBoolean(); // IsJudge BeginDate = pkg.ReadDateTime(); //BeginDate ValidDate = pkg.ReadInt(); //ValidDate Color = pkg.ReadString(); //Color Skin = pkg.ReadString(); //Skin IsUsed = pkg.ReadBoolean(); //IsUsed Hole1 = pkg.ReadInt(); //Hole1 Hole2 = pkg.ReadInt(); //Hole2 Hole3 = pkg.ReadInt(); //Hole3 Hole4 = pkg.ReadInt(); //Hole4 Hole5 = pkg.ReadInt(); //Hole5 Hole6 = pkg.ReadInt(); //Hole6 Pic = pkg.ReadString(); //template.pic RefineryLevel = pkg.ReadInt(); //RefineryLevel pkg.ReadDateTime(); if (isNullable) { pkg.ReadInt(); } pkg.ReadByte(); pkg.ReadInt(); pkg.ReadByte(); pkg.ReadInt(); }
public void HandlePacket(GameClient client, GSPacketIn packet) { client.Player.X = (int)packet.ReadFloatLowEndian(); client.Player.Y = (int)packet.ReadFloatLowEndian(); client.Player.Z = (int)packet.ReadFloatLowEndian(); client.Player.CurrentSpeed = (short)packet.ReadFloatLowEndian(); client.Player.Heading = packet.ReadShort(); ushort flags = packet.ReadShort(); // target visible ? 0xA000 : 0x0000 int spellLevel = packet.ReadByte(); int spellLineIndex = packet.ReadByte(); // two bytes at end, not sure what for client.Player.MovementStartTick = Environment.TickCount; // need to investigate this new UseSpellAction(client.Player, flags, spellLevel, spellLineIndex).Start(1); }
public void HandlePacket(GameClient client, GSPacketIn packet) { client.Player.X = (int)packet.ReadFloatLowEndian(); client.Player.Y = (int)packet.ReadFloatLowEndian(); client.Player.Z = (int)packet.ReadFloatLowEndian(); client.Player.CurrentSpeed = (short)packet.ReadFloatLowEndian(); client.Player.Heading = packet.ReadShort(); ushort flags = packet.ReadShort(); // target visible ? 0xA000 : 0x0000 int index = packet.ReadByte(); int type = packet.ReadByte(); // two bytes at end, not sure what for new UseSkillAction1124(client.Player, flags, index, type).Start(1); }
public void HandleCommand(BaseGame game, Player player, GSPacketIn packet) { if ((game.GameState == eGameState.GameOver || game.GameState == eGameState.ALLSessionStopped) && player.FinishTakeCard && player.CanTakeOut == 0 && !player.HasPaymentTakeCard) { if (player.PlayerDetail.RemoveMoney(486, LogMoneyType.Game, LogMoneyType.Game_PaymentTakeCard) > 0) { int index = (int)packet.ReadByte(); player.CanTakeOut++; player.FinishTakeCard = false; player.HasPaymentTakeCard = true; if (index < 0 || index > game.Cards.Length) { game.TakeCard(player, false); } else { game.TakeCard(player, index, false); } } else { player.PlayerDetail.SendInsufficientMoney(1); } } }
//rewritten by Corillian so if it doesn't work you know who to yell at ;) public void HandlePacket(GameClient client, GSPacketIn packet) { byte grouped = (byte)packet.ReadByte(); ArrayList list = new ArrayList(); if (grouped != 0x00) { ArrayList groups = GroupMgr.ListGroupByStatus(0x00); if (groups != null) { foreach (Group group in groups) if (GameServer.ServerRules.IsAllowedToGroup(group.Leader, client.Player, true)) { list.Add(group.Leader); } } } ArrayList Lfg = GroupMgr.LookingForGroupPlayers(); if (Lfg != null) { foreach (GamePlayer player in Lfg) { if (player != client.Player && GameServer.ServerRules.IsAllowedToGroup(client.Player, player, true)) { list.Add(player); } } } client.Out.SendFindGroupWindowUpdate((GamePlayer[])list.ToArray(typeof(GamePlayer))); }
public void HandleCommand(BaseGame game, Player player, GSPacketIn packet) { if (game.GameState != eGameState.Playing || player.GetSealState()) { return; } int type = packet.ReadByte(); int place = packet.ReadInt(); int templateID = packet.ReadInt(); ItemTemplateInfo template = ItemMgr.FindItemTemplate(templateID); if (player.CanUseItem(template)) { if (player.PlayerDetail.UsePropItem(game, type, place, templateID, player.IsLiving)) { if (player.UseItem(template) == false) { BaseGame.log.Error("Using prop error"); } } else { player.UseItem(template); //player.Prop = template; } } }
public void HandlePacket(GameClient client, GSPacketIn packet) { byte isok =(byte) packet.ReadByte(); byte repair =(byte) packet.ReadByte(); byte combine =(byte) packet.ReadByte(); packet.ReadByte();//unknow ITradeWindow trade = client.Player.TradeWindow; if (trade == null) return; if (isok==0) { trade.CloseTrade(); } else if(isok==1) { if(trade.Repairing != (repair == 1)) trade.Repairing = (repair == 1); if(trade.Combine != (combine == 1)) trade.Combine = (combine == 1); ArrayList tradeSlots = new ArrayList(10); for (int i=0;i<10;i++) { int slotPosition = packet.ReadByte(); InventoryItem item = client.Player.Inventory.GetItem((eInventorySlot)slotPosition); if(item != null && ((item.IsDropable && item.IsTradable) || (client.Player.CanTradeAnyItem || client.Player.TradeWindow.Partner.CanTradeAnyItem))) { tradeSlots.Add(item); } } trade.TradeItems = tradeSlots; packet.ReadShort(); int[] tradeMoney = new int[5]; for(int i=0;i<5;i++) tradeMoney[i]=packet.ReadShort(); long money = Money.GetMoney(tradeMoney[0],tradeMoney[1],tradeMoney[2],tradeMoney[3],tradeMoney[4]); trade.TradeMoney = money; trade.TradeUpdate(); } else if (isok == 2) { trade.AcceptTrade(); } }
public void HandlePacket(GameClient client, GSPacketIn packet) { packet.ReadShort();//unk int action = packet.ReadByte(); int ammo = packet.ReadByte();//(ammo type if command = 'select ammo' ?) if (client.Player.SiegeWeapon == null) return; if (client.Player.IsStealthed) { client.Out.SendMessage("You can't control a siege weapon while hidden!", eChatType.CT_System, eChatLoc.CL_SystemWindow); return; } if (client.Player.IsSitting) { client.Out.SendMessage("You can't fire a siege weapon while sitting!", eChatType.CT_System, eChatLoc.CL_SystemWindow); return; } if (!client.Player.IsAlive || client.Player.IsMezzed || client.Player.IsStunned) { client.Out.SendMessage("You can't control a siege weapon now!", eChatType.CT_System, eChatLoc.CL_SystemWindow); return; } if( !client.Player.IsWithinRadius( client.Player.SiegeWeapon, GameSiegeWeapon.SIEGE_WEAPON_CONTROLE_DISTANCE ) ) { client.Out.SendMessage(client.Player.SiegeWeapon.GetName(0, true) + " is too far away for you to control!", eChatType.CT_System, eChatLoc.CL_SystemWindow); return; } switch (action) { case 1: { client.Player.SiegeWeapon.Load(ammo); } break;//select ammo need Log to know how sent case 2: { client.Player.SiegeWeapon.Arm(); } break;//arm case 3: { client.Player.SiegeWeapon.Aim(); } break;//aim case 4: { client.Player.SiegeWeapon.Fire(); } break;//fire case 5: { client.Player.SiegeWeapon.Move(); } break;//move case 6: { client.Player.SiegeWeapon.Repair(); } break;//repair case 7: { client.Player.SiegeWeapon.salvage(); } break;//salvage case 8: { client.Player.SiegeWeapon.ReleaseControl(); } break;//release case 9: { client.Player.SiegeWeapon.StopMove(); } break;//stop case 10: { client.Player.SiegeWeapon.Fire(); } break;//swing default: { client.Player.Out.SendMessage("Unhandled action ID: " + action, eChatType.CT_System, eChatLoc.CL_SystemWindow); break; } } }
public void HandlePacket(GameClient client, GSPacketIn packet) { if (client == null || client.Player == null) return; int slot = packet.ReadByte(); int unk1 = packet.ReadByte(); ushort unk2 = packet.ReadShort(); uint price = packet.ReadInt(); // ChatUtil.SendDebugMessage(client.Player, "PlayerSetMarketPriceHandler"); // only IGameInventoryObjects can handle set price commands if (client.Player.TargetObject == null || (client.Player.TargetObject is IGameInventoryObject) == false) return; (client.Player.TargetObject as IGameInventoryObject).SetSellPrice(client.Player, (ushort)slot, price); }
public void HandlePacket(GameClient client, GSPacketIn packet) { if (client.Player == null) return; uint X = packet.ReadInt(); uint Y = packet.ReadInt(); ushort id = packet.ReadShort(); ushort item_slot = packet.ReadShort(); byte item_count = (byte)packet.ReadByte(); byte menu_id = (byte)packet.ReadByte(); switch ((eMerchantWindowType)menu_id) { case eMerchantWindowType.HousingInsideShop: case eMerchantWindowType.HousingOutsideShop: case eMerchantWindowType.HousingBindstoneHookpoint: case eMerchantWindowType.HousingCraftingHookpoint: case eMerchantWindowType.HousingNPCHookpoint: case eMerchantWindowType.HousingVaultHookpoint: { HouseMgr.BuyHousingItem(client.Player, item_slot, item_count, (eMerchantWindowType)menu_id); break; } default: { if (client.Player.TargetObject == null) return; //Forward the buy process to the merchant if (client.Player.TargetObject is GameMerchant) { //Let merchant choose what happens ((GameMerchant)client.Player.TargetObject).OnPlayerBuy(client.Player, item_slot, item_count); } else if (client.Player.TargetObject is GameLotMarker) { ((GameLotMarker)client.Player.TargetObject).OnPlayerBuy(client.Player, item_slot, item_count); } break; } } }
public void HandlePacket(GameClient client, GSPacketIn packet) { if(client.Player.Guild == null) return; if(!client.Player.Guild.HasRank(client.Player, Guild.eRank.Leader)) return; int primarycolor = packet.ReadByte() & 0x0F; //4bits int secondarycolor = packet.ReadByte() & 0x07; //3bits int pattern = packet.ReadByte() & 0x03; //2bits int logo = packet.ReadByte(); //8bits int oldemblem = client.Player.Guild.Emblem; int newemblem = ((logo << 9) | (pattern << 7) | (primarycolor << 3) | secondarycolor); if (GuildMgr.IsEmblemUsed(newemblem)) { client.Player.Out.SendMessage("This emblem is already in use by another guild, please choose another!", eChatType.CT_System, eChatLoc.CL_SystemWindow ); return; } GuildMgr.ChangeEmblem(client.Player, oldemblem, newemblem); }
public void HandlePacket(GameClient client, GSPacketIn packet) { int flag = packet.ReadByte(); client.UdpPingTime = DateTime.Now.Ticks; client.UdpConfirm = flag == 1; client.Out.SendGameOpenReply(); client.Out.SendStatusUpdate(); // based on 1.74 logs client.Out.SendUpdatePoints(); // based on 1.74 logs if (client.Player != null) client.Player.UpdateDisabledSkills(); // based on 1.74 logs }
public void HandlePacket(GameClient client, GSPacketIn packet) { var response = (byte)packet.ReadByte(); if (response != 1) // confirm return; var countChosen = (byte)packet.ReadByte(); var itemsChosen = new int[8]; for (int i = 0; i < 8; ++i) itemsChosen[i] = packet.ReadByte(); ushort data2 = packet.ReadShort(); // unknown ushort data3 = packet.ReadShort(); // unknown ushort data4 = packet.ReadShort(); // unknown ushort questID = packet.ReadShort(); ushort questGiverID = packet.ReadShort(); new QuestRewardChosenAction(client.Player, countChosen, itemsChosen, questGiverID, questID).Start(1); }
public void HandlePacket(GameClient client, GSPacketIn packet) { int pid = packet.ReadShort(); int housenumber = packet.ReadShort(); int enter = packet.ReadByte(); // house is null, return House house = HouseMgr.GetHouse(housenumber); if (house == null) return; new EnterLeaveHouseAction(client.Player, house, enter).Start(1); }
public void HandlePacket(GameClient client, GSPacketIn packet) { int unk1 = packet.ReadByte(); int unk2 = packet.ReadByte(); ushort houseNumber = packet.ReadShort(); // house is null, return var house = HouseMgr.GetHouse(houseNumber); if (house == null) return; // player is null, return if (client.Player == null) return; // player has no owner permissions and isn't a GM or admin, return if (!house.HasOwnerPermissions(client.Player) && client.Account.PrivLevel <= 1) return; // build the packet client.Out.SendHouseUsersPermissions(house); }
public void HandlePacket(GameClient client, GSPacketIn packet) { // for 1.115c+ The First client packet Changes. if (client.Version < GameClient.eClientVersion.Version1115) { int rc4 = packet.ReadByte(); byte clientType = (byte)packet.ReadByte(); client.ClientType = (GameClient.eClientType)(clientType & 0x0F); client.ClientAddons = (GameClient.eClientAddons)(clientType & 0xF0); byte major = (byte)packet.ReadByte(); byte minor = (byte)packet.ReadByte(); byte build = (byte)packet.ReadByte(); if(rc4==1) { //DOLConsole.Log("SBox=\n"); //DOLConsole.LogDump(client.PacketProcessor.Encoding.SBox); packet.Read(((PacketEncoding168)client.PacketProcessor.Encoding).SBox,0,256); ((PacketEncoding168)client.PacketProcessor.Encoding).EncryptionState=PacketEncoding168.eEncryptionState.PseudoRC4Encrypted; //DOLConsole.WriteLine(client.Socket.RemoteEndPoint.ToString()+": SBox set!"); //DOLConsole.Log("SBox=\n"); //DOLConsole.LogDump(((PacketEncoding168)client.PacketProcessor.Encoding).SBox); } else { //Send the crypt key to the client client.Out.SendVersionAndCryptKey(); } } else { // we don't handle Encryption for 1.115c // the rc4 secret can't be unencrypted from RSA. // register client type byte clientType = (byte)packet.ReadByte(); client.ClientType = (GameClient.eClientType)(clientType & 0x0F); client.ClientAddons = (GameClient.eClientAddons)(clientType & 0xF0); // if the DataSize is above 7 then the RC4 key is bundled // this is stored in case we find a way to handle encryption someday ! if (packet.DataSize > 7) { packet.Skip(6); ushort length = packet.ReadShortLowEndian(); packet.Read(client.PacketProcessor.Encoding.SBox, 0, length); // ((PacketEncoding168)client.PacketProcessor.Encoding).EncryptionState=PacketEncoding168.eEncryptionState.PseudoRC4Encrypted; } //Send the crypt key to the client client.Out.SendVersionAndCryptKey(); } }
public void HandlePacket(GameClient client, GSPacketIn packet) { byte code =(byte) packet.ReadByte(); switch(code) { case 0x01: GroupMgr.SetPlayerLooking(client.Player); break; case 0x00: GroupMgr.RemovePlayerLooking(client.Player); break; default: Group group = client.Player.Group; if (group != null) { group.Status = code; } break; } }
public void HandlePacket(GameClient client, GSPacketIn packet) { ushort unk1 = packet.ReadShort(); ushort objectOid = packet.ReadShort(); ushort unk2 = packet.ReadShort(); int slot = packet.ReadByte(); int flag = packet.ReadByte(); int currency = packet.ReadByte(); int unk3 = packet.ReadByte(); ushort unk4 = packet.ReadShort(); int type = packet.ReadByte(); int unk5 = packet.ReadByte(); int unk6 = packet.ReadShort(); if (client.Player.Steed == null || client.Player.Steed is GameBoat == false) return; switch (flag) { case 0: { //siegeweapon break; } case 3: { //move GameBoat boat = client.Player.Steed as GameBoat; if (boat.Riders[slot] == null) { client.Player.SwitchSeat(slot); } else { client.Player.Out.SendMessage("That seat isn't empty!", eChatType.CT_System, eChatLoc.CL_SystemWindow); } break; } default: { GameServer.KeepManager.Log.Error(string.Format("Unhandled ShipHookpointInteract client to server packet unk1 {0} objectOid {1} unk2 {2} slot {3} flag {4} currency {5} unk3 {6} unk4 {7} type {8} unk5 {9} unk6 {10}", unk1, objectOid, unk2, slot, flag, currency, unk3, unk4, type, unk5, unk6)); break; } } }
public void HandlePacket(GameClient client, GSPacketIn packet) { int housenumber = packet.ReadShort(); int menuid = packet.ReadByte(); int flag = packet.ReadByte(); var house = HouseMgr.GetHouse(client.Player.CurrentRegionID, housenumber); if (house == null) return; if (client.Player == null) return; client.Player.CurrentHouse = house; switch (menuid) { case 0: // Exterior decoration (Garden) { if (!house.CanChangeGarden(client.Player, DecorationPermissions.Add)) return; HouseMgr.SendHousingMerchantWindow(client.Player, eMerchantWindowType.HousingOutsideShop); break; } case 1: // Interior decoration { if (!house.CanChangeInterior(client.Player, DecorationPermissions.Add)) return; HouseMgr.SendHousingMerchantWindow(client.Player, eMerchantWindowType.HousingInsideShop); break; } case 2: // Exterior menu { if (!house.CanChangeGarden(client.Player, DecorationPermissions.Add)) return; client.Player.Out.SendMerchantWindow(HouseTemplateMgr.OutdoorMenuItems, eMerchantWindowType.HousingOutsideMenu); break; } case 3: // interior npc { if (!house.CanChangeInterior(client.Player, DecorationPermissions.Add)) return; HouseMgr.SendHousingMerchantWindow(client.Player, eMerchantWindowType.HousingNPCHookpoint); break; } case 4: // vault shop { if (!house.CanChangeInterior(client.Player, DecorationPermissions.Add)) return; HouseMgr.SendHousingMerchantWindow(client.Player, eMerchantWindowType.HousingVaultHookpoint); break; } case 5: // craft shop { if (!house.CanChangeInterior(client.Player, DecorationPermissions.Add)) return; HouseMgr.SendHousingMerchantWindow(client.Player, eMerchantWindowType.HousingCraftingHookpoint); break; } case 6: // bindstone shop { if (!house.CanChangeInterior(client.Player, DecorationPermissions.Add)) return; HouseMgr.SendHousingMerchantWindow(client.Player, eMerchantWindowType.HousingBindstoneHookpoint); break; } case 7: house.SendHouseInfo(client.Player); break; case 8: // Interior menu (flag = 0x00 - roof, 0xFF - floor or wall) if (!house.CanChangeInterior(client.Player, DecorationPermissions.Add)) return; client.Player.Out.SendMerchantWindow(HouseTemplateMgr.IndoorMenuItems, eMerchantWindowType.HousingInsideMenu); break; default: client.Out.SendMessage("Invalid menu id " + menuid + " (hookpoint?).", eChatType.CT_System, eChatLoc.CL_SystemWindow); break; } }
public void HandlePacket(GameClient client, GSPacketIn packet) { var status = (byte) packet.ReadByte(); new SitRequestHandler(client.Player, status != 0x00).Start(1); }
public void HandlePacket(GameClient client, GSPacketIn packet) { int level = packet.ReadByte(); int unk1 = packet.ReadByte(); ushort housenumber = packet.ReadShort(); // make sure permission level is within bounds if (level < HousingConstants.MinPermissionLevel || level > HousingConstants.MaxPermissionLevel) return; // house is null, return var house = HouseMgr.GetHouse(housenumber); if (house == null) return; // player is null, return if (client.Player == null) return; // player has no owner permissions and isn't a GM or admin, return if (!house.HasOwnerPermissions(client.Player) && client.Account.PrivLevel <= 1) return; // read in the permission values DBHousePermissions permission = house.PermissionLevels[level]; permission.CanEnterHouse = (packet.ReadByte() != 0); permission.Vault1 = (byte) packet.ReadByte(); permission.Vault2 = (byte) packet.ReadByte(); permission.Vault3 = (byte) packet.ReadByte(); permission.Vault4 = (byte) packet.ReadByte(); permission.CanChangeExternalAppearance = (packet.ReadByte() != 0); permission.ChangeInterior = (byte) packet.ReadByte(); permission.ChangeGarden = (byte) packet.ReadByte(); permission.CanBanish = (packet.ReadByte() != 0); permission.CanUseMerchants = (packet.ReadByte() != 0); permission.CanUseTools = (packet.ReadByte() != 0); permission.CanBindInHouse = (packet.ReadByte() != 0); permission.ConsignmentMerchant = (byte) packet.ReadByte(); permission.CanPayRent = (packet.ReadByte() != 0); int unk2 = (byte) packet.ReadByte(); // save the updated permission GameServer.Database.SaveObject(permission); }
/// <summary> /// door index which is unique /// </summary> public void HandlePacket(GameClient client, GSPacketIn packet) { var doorID = (int)packet.ReadInt(); m_handlerDoorID = doorID; var doorState = (byte)packet.ReadByte(); int doorType = doorID / 100000000; int radius = ServerProperties.Properties.WORLD_PICKUP_DISTANCE * 2; int zoneDoor = (int)(doorID / 1000000); string debugText = ""; // For ToA the client always sends the same ID so we need to construct an id using the current zone if (client.Player.CurrentRegion.Expansion == (int)eClientExpansion.TrialsOfAtlantis) { debugText = "ToA DoorID: " + doorID + " "; doorID -= zoneDoor * 1000000; zoneDoor = client.Player.CurrentZone.ID; doorID += zoneDoor * 1000000; m_handlerDoorID = doorID; // experimental to handle a few odd TOA door issues if (client.Player.CurrentRegion.IsDungeon) radius *= 4; } // debug text if (client.Account.PrivLevel > 1 || Properties.ENABLE_DEBUG) { if (doorType == 7) { int ownerKeepId = (doorID / 100000) % 1000; int towerNum = (doorID / 10000) % 10; int keepID = ownerKeepId + towerNum * 256; int componentID = (doorID / 100) % 100; int doorIndex = doorID % 10; client.Out.SendDebugMessage( "Keep Door ID: {0} state:{1} (Owner Keep: {6} KeepID:{2} ComponentID:{3} DoorIndex:{4} TowerNumber:{5})", doorID, doorState, keepID, componentID, doorIndex, towerNum, ownerKeepId); } else if (doorType == 9) { int doorIndex = doorID - doorType * 10000000; client.Out.SendDebugMessage("House DoorID:{0} state:{1} (doorType:{2} doorIndex:{3})", doorID, doorState, doorType, doorIndex); } else { int fixture = (doorID - zoneDoor * 1000000); int fixturePiece = fixture; fixture /= 100; fixturePiece = fixturePiece - fixture * 100; client.Out.SendDebugMessage("{6}DoorID:{0} state:{1} zone:{2} fixture:{3} fixturePiece:{4} Type:{5}", doorID, doorState, zoneDoor, fixture, fixturePiece, doorType, debugText); } } var target = client.Player.TargetObject as GameDoor; if (target != null && !client.Player.IsWithinRadius(target, radius)) { client.Player.Out.SendMessage("You are too far to open this door", eChatType.CT_Important, eChatLoc.CL_SystemWindow); return; } var door = GameServer.Database.SelectObject<DBDoor>("InternalID = '" + doorID + "'"); if (door != null) { if (doorType == 7 || doorType == 9) { new ChangeDoorAction(client.Player, doorID, doorState, radius).Start(1); return; } if (client.Account.PrivLevel == 1) { if (door.Locked == 0) { if (door.Health == 0) { new ChangeDoorAction(client.Player, doorID, doorState, radius).Start(1); return; } if (GameServer.Instance.Configuration.ServerType == eGameServerType.GST_PvP) { if (door.Realm != 0) { new ChangeDoorAction(client.Player, doorID, doorState, radius).Start(1); return; } } if (GameServer.Instance.Configuration.ServerType == eGameServerType.GST_Normal) { if (client.Player.Realm == (eRealm)door.Realm || door.Realm == 6) { new ChangeDoorAction(client.Player, doorID, doorState, radius).Start(1); return; } } } } if (client.Account.PrivLevel > 1) { client.Out.SendDebugMessage("GM: Forcing locked door open."); new ChangeDoorAction(client.Player, doorID, doorState, radius).Start(1); return; } } if (door == null) { if (doorType != 9 && client.Account.PrivLevel > 1 && client.Player.CurrentRegion.IsInstance == false) { if (client.Player.TempProperties.getProperty(DoorMgr.WANT_TO_ADD_DOORS, false)) { client.Player.Out.SendCustomDialog( "This door is not in the database. Place yourself nearest to this door and click Accept to add it.", AddingDoor); } else { client.Player.Out.SendMessage( "This door is not in the database. Use '/door show' to enable the add door dialog when targeting doors.", eChatType.CT_Important, eChatLoc.CL_SystemWindow); } } new ChangeDoorAction(client.Player, doorID, doorState, radius).Start(1); return; } }