public static void TradeRequestRequest(IRealmClient client, RealmPacketIn packet) { if (client.ActiveCharacter.Asda2TradeWindow != null) { if (client.ActiveCharacter.Asda2TradeWindow.Expired) { client.ActiveCharacter.Asda2TradeWindow.CancelTrade(); } else { client.ActiveCharacter.SendSystemMessage("You already trading."); SendTradeRejectedResponse(client); return; } } ushort sessId = packet.ReadUInt16(); Asda2TradeType tradeType = (Asda2TradeType)packet.ReadByte(); Character characterBySessionId = World.GetCharacterBySessionId(sessId); if (characterBySessionId == null) { client.ActiveCharacter.SendSystemMessage("Sorry, but i can't find character you want trade."); SendTradeRejectedResponse(client); } else if (characterBySessionId.Map != client.ActiveCharacter.Map) { characterBySessionId.YouAreFuckingCheater("Trying to buy items from character with another map.", 50); SendTradeRejectedResponse(client); } else if (!characterBySessionId.EnableGeneralTradeRequest && tradeType == Asda2TradeType.RedularTrade) { client.ActiveCharacter.SendSystemMessage(string.Format("{0} rejected all general trade requests.", characterBySessionId.Name)); SendTradeRejectedResponse(client); } else if (!characterBySessionId.EnableGearTradeRequest && tradeType == Asda2TradeType.ShopItemsTrade) { client.ActiveCharacter.SendSystemMessage(string.Format("{0} rejected all gear trade requests.", characterBySessionId.Name)); SendTradeRejectedResponse(client); } else if (client.ActiveCharacter.PrivateShop != null) { client.ActiveCharacter.YouAreFuckingCheater( "Target character is in private shop and can't accept trade.", 20); SendTradeRejectedResponse(client); } else if (client.ActiveCharacter.IsAsda2BattlegroundInProgress) { client.ActiveCharacter.SendInfoMsg("Can't trade on war."); SendTradeRejectedResponse(client); } else if (characterBySessionId.PrivateShop != null) { SendTradeRejectedResponse(client); } else { Asda2TradeWindow asda2TradeWindow = new Asda2TradeWindow { FisrtChar = client.ActiveCharacter, SecondChar = characterBySessionId }; asda2TradeWindow.Init(); client.ActiveCharacter.Asda2TradeWindow = asda2TradeWindow; characterBySessionId.Asda2TradeWindow = asda2TradeWindow; asda2TradeWindow.TradeType = tradeType; SendTradeRequestResponse(characterBySessionId.Client, client.ActiveCharacter, tradeType); } }
[PacketHandler(RealmServerOpCode.TradeRequest)] //5282 public static void TradeRequestRequest(IRealmClient client, RealmPacketIn packet) { if (client.ActiveCharacter.Asda2TradeWindow != null) { if (client.ActiveCharacter.Asda2TradeWindow.Expired) { client.ActiveCharacter.Asda2TradeWindow.CancelTrade(); } else { client.ActiveCharacter.SendSystemMessage("You already trading."); SendTradeRejectedResponse(client); return; } /*if (RealmServer.IsPreparingShutdown || RealmServer.IsShuttingDown) * client.acti*/ } var characterSessionNum = packet.ReadUInt16(); //default : 0Len : 2 var typeOfTrade = (Asda2TradeType)packet.ReadByte(); //default : 0Len : 1 var targetChr = World.GetCharacterBySessionId(characterSessionNum); if (targetChr == null) { client.ActiveCharacter.SendSystemMessage("Sorry, but i can't find character you want trade."); SendTradeRejectedResponse(client); return; } if (targetChr.Map != client.ActiveCharacter.Map) { targetChr.YouAreFuckingCheater("Trying to buy items from character with another map.", 50); SendTradeRejectedResponse(client); return; } if (!targetChr.EnableGeneralTradeRequest && typeOfTrade == Asda2TradeType.RedularTrade) { client.ActiveCharacter.SendSystemMessage(string.Format("{0} rejected all general trade requests.", targetChr.Name)); SendTradeRejectedResponse(client); return; } if (!targetChr.EnableGearTradeRequest && typeOfTrade == Asda2TradeType.ShopItemsTrade) { client.ActiveCharacter.SendSystemMessage(string.Format("{0} rejected all gear trade requests.", targetChr.Name)); SendTradeRejectedResponse(client); return; } if (client.ActiveCharacter.PrivateShop != null) { client.ActiveCharacter.YouAreFuckingCheater("Target character is in private shop and can't accept trade.", 20); SendTradeRejectedResponse(client); return; } if (client.ActiveCharacter.IsAsda2BattlegroundInProgress) { client.ActiveCharacter.SendInfoMsg("Can't trade on war."); SendTradeRejectedResponse(client); return; } if (RealmServer.IsPreparingShutdown || RealmServer.IsShuttingDown) { SendTradeRejectedResponse(client); return; } if (targetChr.PrivateShop != null) { SendTradeRejectedResponse(client); return; } var tradeWindow = new Asda2TradeWindow { FisrtChar = client.ActiveCharacter, SecondChar = targetChr }; tradeWindow.Init(); client.ActiveCharacter.Asda2TradeWindow = tradeWindow; targetChr.Asda2TradeWindow = tradeWindow; tradeWindow.TradeType = typeOfTrade; SendTradeRequestResponse(targetChr.Client, client.ActiveCharacter, typeOfTrade); }