예제 #1
0
 public void On_CMSG_CANCEL_TRADE(ref Packets.PacketClass packet, ref WS_Network.ClientClass client)
 {
     if (client == null || client.Character == null)
     {
         return;
     }
     WorldServiceLocator._WorldServer.Log.WriteLine(LogType.DEBUG, "[{0}:{1}] CMSG_CANCEL_TRADE", client.IP, client.Port);
     if (client.Character.tradeInfo == null)
     {
         return;
     }
     Packets.PacketClass response = new(Opcodes.SMSG_TRADE_STATUS);
     try
     {
         response.AddInt32(3);
         if (client.Character.tradeInfo.Target != null)
         {
             client.Character.tradeInfo.Target.client.SendMultiplyPackets(ref response);
         }
         if (client.Character.tradeInfo.Trader != null)
         {
             client.Character.tradeInfo.Trader.client.SendMultiplyPackets(ref response);
         }
     }
     finally
     {
         response.Dispose();
     }
     client.Character.tradeInfo.Dispose();
 }
예제 #2
0
 public void SendActionButtons(ref WS_Network.ClientClass client, ref WS_PlayerData.CharacterObject Character)
 {
     Packets.PacketClass packet = new Packets.PacketClass(Opcodes.SMSG_ACTION_BUTTONS);
     try
     {
         byte i = 0;
         do
         {
             checked
             {
                 if (Character.ActionButtons.ContainsKey(i))
                 {
                     packet.AddUInt16((ushort)Character.ActionButtons[i].Action);
                     packet.AddInt8(Character.ActionButtons[i].ActionType);
                     packet.AddInt8(Character.ActionButtons[i].ActionMisc);
                 }
                 else
                 {
                     packet.AddInt32(0);
                 }
                 i = (byte)unchecked ((uint)(i + 1));
             }
         }while (i <= 119u);
         client.Send(ref packet);
     }
     finally
     {
         packet.Dispose();
     }
 }
예제 #3
0
 public void On_CMSG_PETITION_SIGN(ref Packets.PacketClass packet, ref WS_Network.ClientClass client)
 {
     checked
     {
         if (packet.Data.Length - 1 < 14)
         {
             return;
         }
         packet.GetInt16();
         ulong itemGuid = packet.GetUInt64();
         int   Unk      = packet.GetInt8();
         WorldServiceLocator._WorldServer.Log.WriteLine(LogType.DEBUG, "[{0}:{1}] CMSG_PETITION_SIGN [GUID={2:X} Unk={3}]", client.IP, client.Port, itemGuid, Unk);
         DataTable MySQLQuery = new();
         WorldServiceLocator._WorldServer.CharacterDatabase.Query("SELECT petition_signedMembers, petition_owner FROM petitions WHERE petition_itemGuid = " + Conversions.ToString(itemGuid - WorldServiceLocator._Global_Constants.GUID_ITEM) + ";", ref MySQLQuery);
         if (MySQLQuery.Rows.Count != 0)
         {
             WorldServiceLocator._WorldServer.CharacterDatabase.Update(Conversions.ToString(Operators.ConcatenateObject(Operators.ConcatenateObject(Operators.ConcatenateObject(Operators.ConcatenateObject(Operators.ConcatenateObject(Operators.ConcatenateObject("UPDATE petitions SET petition_signedMembers = petition_signedMembers + 1, petition_signedMember", Operators.AddObject(MySQLQuery.Rows[0]["petition_signedMembers"], 1)), " = "), client.Character.GUID), " WHERE petition_itemGuid = "), itemGuid - WorldServiceLocator._Global_Constants.GUID_ITEM), ";")));
             Packets.PacketClass response = new(Opcodes.SMSG_PETITION_SIGN_RESULTS);
             response.AddUInt64(itemGuid);
             response.AddUInt64(client.Character.GUID);
             response.AddInt32(0);
             client.SendMultiplyPackets(ref response);
             if (WorldServiceLocator._WorldServer.CHARACTERs.ContainsKey(MySQLQuery.Rows[0].As <ulong>("petition_owner")))
             {
                 WorldServiceLocator._WorldServer.CHARACTERs[MySQLQuery.Rows[0].As <ulong>("petition_owner")].client.SendMultiplyPackets(ref response);
             }
             response.Dispose();
         }
     }
 }
예제 #4
0
 public void On_CMSG_AUTOSTORE_LOOT_ITEM(ref Packets.PacketClass packet, ref WS_Network.ClientClass client)
 {
     if (checked (packet.Data.Length - 1) < 6)
     {
         return;
     }
     try
     {
         packet.GetInt16();
         byte slot = packet.GetInt8();
         WorldServiceLocator._WorldServer.Log.WriteLine(LogType.DEBUG, "[{0}:{1}] CMSG_AUTOSTORE_LOOT_ITEM [slot={2}]", client.IP, client.Port, slot);
         if (LootTable.ContainsKey(client.Character.lootGUID))
         {
             LootTable[client.Character.lootGUID].GetLoot(ref client, slot);
             return;
         }
         Packets.PacketClass response = new(Opcodes.SMSG_INVENTORY_CHANGE_FAILURE);
         response.AddInt8(49);
         response.AddUInt64(0uL);
         response.AddUInt64(0uL);
         response.AddInt8(0);
         client.Send(ref response);
         response.Dispose();
     }
     catch (Exception e)
     {
         WorldServiceLocator._WorldServer.Log.WriteLine(LogType.DEBUG, "Error looting item.{0}", Environment.NewLine + e);
     }
 }
예제 #5
0
 public void On_CMSG_LOOT_MONEY(ref Packets.PacketClass packet, ref WS_Network.ClientClass client)
 {
     WorldServiceLocator._WorldServer.Log.WriteLine(LogType.DEBUG, "[{0}:{1}] CMSG_LOOT_MONEY", client.IP, client.Port);
     if (!LootTable.ContainsKey(client.Character.lootGUID))
     {
         return;
     }
     checked
     {
         if (client.Character.IsInGroup)
         {
             List <WS_Base.BaseUnit> members = WorldServiceLocator._WS_Spells.GetPartyMembersAroundMe(ref client.Character, 100f);
             LootTable[client.Character.lootGUID].Money = 0;
             Packets.PacketClass sharePcket = new(Opcodes.SMSG_LOOT_MONEY_NOTIFY);
             int copper2 = (LootTable[client.Character.lootGUID].Money / members.Count) + 1;
             sharePcket.AddInt32(copper2);
             foreach (WS_PlayerData.CharacterObject character in members)
             {
                 character.client.SendMultiplyPackets(ref sharePcket);
                 ref uint copper3 = ref character.Copper;
                 copper3 = (uint)(copper3 + copper2);
                 character.SetUpdateFlag(1176, character.Copper);
                 character.SaveCharacter();
             }
             client.SendMultiplyPackets(ref sharePcket);
             ref uint copper4 = ref client.Character.Copper;
             copper4 = (uint)(copper4 + copper2);
             sharePcket.Dispose();
         }
예제 #6
0
 public void SendFactions(ref WS_Network.ClientClass client, ref WS_PlayerData.CharacterObject Character)
 {
     Packets.PacketClass packet = new Packets.PacketClass(Opcodes.SMSG_INITIALIZE_FACTIONS);
     try
     {
         packet.AddInt32(64);
         byte i = 0;
         do
         {
             checked
             {
                 if (Character.Reputation != null)
                 {
                     packet.AddInt8((byte)Character.Reputation[i].Flags);
                 }
                 packet.AddInt32(Character.Reputation[i].Value);
                 i = (byte)unchecked ((uint)(i + 1));
             }
         }while (i <= 63u);
         client.Send(ref packet);
     }
     finally
     {
         packet.Dispose();
     }
 }
예제 #7
0
 public void On_CMSG_STANDSTATECHANGE(ref Packets.PacketClass packet, ref WS_Network.ClientClass client)
 {
     if (checked (packet.Data.Length - 1) >= 6)
     {
         packet.GetInt16();
         var StandState = packet.GetInt8();
         if (StandState == 0)
         {
             client.Character.RemoveAurasByInterruptFlag(262144);
         }
         client.Character.StandState = StandState;
         client.Character.SetUpdateFlag(138, client.Character.cBytes1);
         client.Character.SendCharacterUpdate();
         Packets.PacketClass packetACK = new(Opcodes.SMSG_STANDSTATE_CHANGE_ACK);
         try
         {
             packetACK.AddInt8(StandState);
             client.Send(ref packetACK);
         }
         finally
         {
             packetACK.Dispose();
         }
         WorldServiceLocator._WorldServer.Log.WriteLine(LogType.DEBUG, "[{0}:{1}] CMSG_STANDSTATECHANGE [{2}]", client.IP, client.Port, client.Character.StandState);
     }
 }
예제 #8
0
    public void On_CMSG_SET_TRADE_ITEM(ref Packets.PacketClass packet, ref WS_Network.ClientClass client)
    {
        packet.GetInt16();
        var myBag = packet.GetInt8();

        if (myBag == byte.MaxValue)
        {
            myBag = 0;
        }
        var slot = packet.GetInt8();

        if (slot > 6)
        {
            return;
        }
        var mySlot = packet.GetInt8();

        WorldServiceLocator._WorldServer.Log.WriteLine(LogType.DEBUG, "[{0}:{1}] CMSG_SET_TRADE_ITEM [slot={2} myBag={3} mySlot={4}]", client.IP, client.Port, slot, myBag, mySlot);
        checked
        {
            if (client.Character.tradeInfo != null)
            {
                if (client.Character.tradeInfo.Trader == client.Character)
                {
                    client.Character.tradeInfo.TraderSlots[slot] = (myBag << 8) + mySlot;
                    client.Character.tradeInfo.SendTradeUpdateToTarget();
                }
                else
                {
                    client.Character.tradeInfo.TargetSlots[slot] = (myBag << 8) + mySlot;
                    client.Character.tradeInfo.SendTradeUpdateToTrader();
                }
            }
        }
    }
예제 #9
0
        public void On_CMSG_LOGOUT_CANCEL(ref Packets.PacketClass packet, ref WS_Network.ClientClass client)
        {
            try
            {
                WorldServiceLocator._WorldServer.Log.WriteLine(LogType.DEBUG, "[{0}:{1}] CMSG_LOGOUT_CANCEL", client.IP, client.Port);
                if (client != null && client.Character != null && client.Character.LogoutTimer != null)
                {
                    client.Character.LogoutTimer?.Dispose();
                    client.Character.LogoutTimer = null;

                    Packets.UpdateClass UpdateData         = new Packets.UpdateClass(WorldServiceLocator._Global_Constants.FIELD_MASK_SIZE_PLAYER);
                    Packets.PacketClass SMSG_UPDATE_OBJECT = new Packets.PacketClass(Opcodes.SMSG_UPDATE_OBJECT);
                    try
                    {
                        SMSG_UPDATE_OBJECT.AddInt32(1);
                        SMSG_UPDATE_OBJECT.AddInt8(0);
                        client.Character.cUnitFlags &= -262145;
                        UpdateData.SetUpdateFlag(46, client.Character.cUnitFlags);
                        client.Character.StandState = 0;
                        UpdateData.SetUpdateFlag(138, client.Character.cBytes1);
                        WS_PlayerData.CharacterObject updateObject = client.Character;
                        UpdateData.AddToPacket(ref SMSG_UPDATE_OBJECT, ObjectUpdateType.UPDATETYPE_VALUES, ref updateObject);
                        client.Send(ref SMSG_UPDATE_OBJECT);
                    }
                    finally
                    {
                        SMSG_UPDATE_OBJECT.Dispose();
                    }
                    Packets.PacketClass packetACK = new Packets.PacketClass(Opcodes.SMSG_STANDSTATE_CHANGE_ACK);
                    try
                    {
                        packetACK.AddInt8(0);
                        client.Send(ref packetACK);
                    }
                    finally
                    {
                        packetACK.Dispose();
                    }
                    Packets.PacketClass SMSG_LOGOUT_CANCEL_ACK = new Packets.PacketClass(Opcodes.SMSG_LOGOUT_CANCEL_ACK);
                    try
                    {
                        client.Send(ref SMSG_LOGOUT_CANCEL_ACK);
                    }
                    finally
                    {
                        SMSG_LOGOUT_CANCEL_ACK.Dispose();
                    }
                    WorldServiceLocator._WorldServer.Log.WriteLine(LogType.DEBUG, "[{0}:{1}] SMSG_LOGOUT_CANCEL_ACK", client.IP, client.Port);
                    client.Character.SetMoveUnroot();
                }
            }
            catch (Exception ex)
            {
                ProjectData.SetProjectError(ex);
                Exception e = ex;
                WorldServiceLocator._WorldServer.Log.WriteLine(LogType.CRITICAL, "Error while trying to cancel logout.{0}", Environment.NewLine + e);
                ProjectData.ClearProjectError();
            }
        }
예제 #10
0
    public void DumpPacket(byte[] data, WS_Network.ClientClass client = null, int start = 0)
    {
        var buffer = "";

        checked
        {
            try
            {
                buffer = (client != null) ? (buffer + $"[{client.IP}:{client.Port}] DEBUG: Packet Dump - Length={data.Length - start}{Environment.NewLine}") : (buffer + $"DEBUG: Packet Dump{Environment.NewLine}");
                if (checked (data.Length - start) % 16 == 0)
                {
                    var num = data.Length - 1;
                    for (var i = start; i <= num; i += 16)
                    {
                        buffer = buffer + "|  " + BitConverter.ToString(data, i, 16).Replace("-", " ");
                        buffer = buffer + " |  " + Encoding.ASCII.GetString(data, i, 16).Replace("\t", "?").Replace("\b", "?")
                                 .Replace("\r", "?")
                                 .Replace("\f", "?")
                                 .Replace("\n", "?") + " |" + Environment.NewLine;
                    }
                }
                else
                {
                    var num2 = data.Length - 1 - 16;
                    int i;
                    for (i = start; i <= num2; i += 16)
                    {
                        buffer = buffer + "|  " + BitConverter.ToString(data, i, 16).Replace("-", " ");
                        buffer = buffer + " |  " + Encoding.ASCII.GetString(data, i, 16).Replace("\t", "?").Replace("\b", "?")
                                 .Replace("\r", "?")
                                 .Replace("\f", "?")
                                 .Replace("\n", "?") + " |" + Environment.NewLine;
                    }
                    unchecked
                    {
                        buffer = buffer + "|  " + BitConverter.ToString(data, i, checked (data.Length - start) % 16).Replace("-", " ");
                    }
                    buffer += new string(' ', (16 - (checked (data.Length - start) % 16)) * 3);
                    unchecked
                    {
                        buffer = buffer + " |  " + Encoding.ASCII.GetString(data, i, checked (data.Length - start) % 16).Replace("\t", "?").Replace("\b", "?")
                                 .Replace("\r", "?")
                                 .Replace("\f", "?")
                                 .Replace("\n", "?");
                    }
                    buffer += new string(' ', 16 - (checked (data.Length - start) % 16));
                    buffer  = buffer + " |" + Environment.NewLine;
                }
                WorldServiceLocator._WorldServer.Log.WriteLine(LogType.DEBUG, buffer, null);
            }
            catch (Exception ex)
            {
                ProjectData.SetProjectError(ex);
                var e = ex;
                WorldServiceLocator._WorldServer.Log.WriteLine(LogType.FAILED, "Error dumping packet: {0}{1}", Environment.NewLine, e.ToString());
                ProjectData.ClearProjectError();
            }
        }
    }
예제 #11
0
 public void SendRelease(ref WS_Network.ClientClass client)
 {
     Packets.PacketClass responseRelease = new(Opcodes.SMSG_LOOT_RELEASE_RESPONSE);
     responseRelease.AddUInt64(GUID);
     responseRelease.AddInt8(1);
     client.Send(ref responseRelease);
     responseRelease.Dispose();
 }
예제 #12
0
 public void OnWorldPacket(ref Packets.PacketClass packet, ref WS_Network.ClientClass client)
 {
     WorldServiceLocator._WorldServer.Log.WriteLine(LogType.WARNING, "[{0}:{1}] {2} [Redirected Packet]", client.IP, client.Port, packet.OpCode);
     if (client.Character == null || !client.Character.FullyLoggedIn)
     {
         WorldServiceLocator._WorldServer.Log.WriteLine(LogType.WARNING, "[{0}:{1}] Unknown Opcode 0x{2:X} [{2}], DataLen={4}", client.IP, client.Port, packet.OpCode, Environment.NewLine, packet.Length);
         WorldServiceLocator._Packets.DumpPacket(packet.Data, client);
     }
 }
예제 #13
0
 public void On_MSG_TABARDVENDOR_ACTIVATE(ref Packets.PacketClass packet, ref WS_Network.ClientClass client)
 {
     if (checked (packet.Data.Length - 1) >= 13)
     {
         packet.GetInt16();
         ulong GUID = packet.GetUInt64();
         WorldServiceLocator._WorldServer.Log.WriteLine(LogType.DEBUG, "[{0}:{1}] MSG_TABARDVENDOR_ACTIVATE [GUID={2}]", client.IP, client.Port, GUID);
         SendTabardActivate(ref client.Character, GUID);
     }
 }
예제 #14
0
    public void On_CMSG_SET_ACTIONBAR_TOGGLES(ref Packets.PacketClass packet, ref WS_Network.ClientClass client)
    {
        packet.GetInt16();
        var ActionBar = packet.GetInt8();

        WorldServiceLocator._WorldServer.Log.WriteLine(LogType.DEBUG, "[{0}:{1}] CMSG_SET_ACTIONBAR_TOGGLES [{2:X}]", client.IP, client.Port, ActionBar);
        client.Character.cPlayerFieldBytes = (client.Character.cPlayerFieldBytes & -983041) | (byte)(ActionBar << (0x10 & 7));
        client.Character.SetUpdateFlag(1222, client.Character.cPlayerFieldBytes);
        client.Character.SendCharacterUpdate();
    }
예제 #15
0
 public void On_CMSG_PETITION_SHOWLIST(ref Packets.PacketClass packet, ref WS_Network.ClientClass client)
 {
     if (checked (packet.Data.Length - 1) >= 13)
     {
         packet.GetInt16();
         ulong GUID = packet.GetUInt64();
         WorldServiceLocator._WorldServer.Log.WriteLine(LogType.DEBUG, "[{0}:{1}] CMSG_PETITION_SHOWLIST [GUID={2:X}]", client.IP, client.Port, GUID);
         SendPetitionActivate(ref client.Character, GUID);
     }
 }
예제 #16
0
 public void On_CMSG_TURN_IN_PETITION(ref Packets.PacketClass packet, ref WS_Network.ClientClass client)
 {
     if (checked (packet.Data.Length - 1) >= 13)
     {
         packet.GetInt16();
         ulong itemGuid = packet.GetUInt64();
         WorldServiceLocator._WorldServer.Log.WriteLine(LogType.DEBUG, "[{0}:{1}] CMSG_TURN_IN_PETITION [GUID={2:X}]", client.IP, client.Port, itemGuid);
         client.Character.ItemREMOVE(itemGuid, Destroy: true, Update: true);
     }
 }
예제 #17
0
 public void On_CMSG_PETITION_QUERY(ref Packets.PacketClass packet, ref WS_Network.ClientClass client)
 {
     checked
     {
         if (packet.Data.Length - 1 < 17)
         {
             return;
         }
         packet.GetInt16();
         int   PetitionGUID = packet.GetInt32();
         ulong itemGuid     = packet.GetUInt64();
         WorldServiceLocator._WorldServer.Log.WriteLine(LogType.DEBUG, "[{0}:{1}] CMSG_PETITION_QUERY [pGUID={3} iGUID={2:X}]", client.IP, client.Port, itemGuid, PetitionGUID);
         DataTable MySQLQuery = new();
         WorldServiceLocator._WorldServer.CharacterDatabase.Query("SELECT * FROM petitions WHERE petition_itemGuid = " + Conversions.ToString(itemGuid - WorldServiceLocator._Global_Constants.GUID_ITEM) + ";", ref MySQLQuery);
         if (MySQLQuery.Rows.Count != 0)
         {
             Packets.PacketClass response = new(Opcodes.SMSG_PETITION_QUERY_RESPONSE);
             response.AddInt32(MySQLQuery.Rows[0].As <int>("petition_id"));
             response.AddUInt64(MySQLQuery.Rows[0].As <ulong>("petition_owner"));
             response.AddString(MySQLQuery.Rows[0].As <string>("petition_name"));
             response.AddInt8(0);
             if (MySQLQuery.Rows[0].As <byte>("petition_type") == 9)
             {
                 response.AddInt32(9);
                 response.AddInt32(9);
                 response.AddInt32(0);
             }
             else
             {
                 response.AddInt32(MySQLQuery.Rows[0].As <byte>("petition_type") - 1);
                 response.AddInt32(MySQLQuery.Rows[0].As <byte>("petition_type") - 1);
                 response.AddInt32(MySQLQuery.Rows[0].As <byte>("petition_type"));
             }
             response.AddInt32(0);
             response.AddInt32(0);
             response.AddInt32(0);
             response.AddInt32(0);
             response.AddInt16(0);
             response.AddInt32(0);
             response.AddInt32(0);
             response.AddInt32(0);
             response.AddInt32(0);
             if (MySQLQuery.Rows[0].As <byte>("petition_type") == 9)
             {
                 response.AddInt32(0);
             }
             else
             {
                 response.AddInt32(1);
             }
             client.Send(ref response);
             response.Dispose();
         }
     }
 }
예제 #18
0
    public void On_CMSG_TUTORIAL_RESET(ref Packets.PacketClass packet, ref WS_Network.ClientClass client)
    {
        WorldServiceLocator._WorldServer.Log.WriteLine(LogType.DEBUG, "[{0}:{1}] CMSG_TUTORIAL_RESET", client.IP, client.Port);
        var i = 0;

        do
        {
            client.Character.TutorialFlags[i] = 0;
            i = checked (i + 1);
        }while (i <= 31);
        client.Character.SaveCharacter();
    }
예제 #19
0
 public void On_CMSG_TAXINODE_STATUS_QUERY(ref Packets.PacketClass packet, ref WS_Network.ClientClass client)
 {
     if (checked (packet.Data.Length - 1) >= 13)
     {
         packet.GetInt16();
         var guid = packet.GetUInt64();
         WorldServiceLocator._WorldServer.Log.WriteLine(LogType.DEBUG, "[{0}:{1}] CMSG_TAXINODE_STATUS_QUERY [taxiGUID={2:X}]", client.IP, client.Port, guid);
         if (WorldServiceLocator._WorldServer.WORLD_CREATUREs.ContainsKey(guid))
         {
             SendTaxiStatus(ref client.Character, guid);
         }
     }
 }
예제 #20
0
 public void SendWeather(int ZoneID, ref WS_Network.ClientClass client)
 {
     if (WeatherZones.ContainsKey(ZoneID))
     {
         var Weather = WeatherZones[ZoneID];
         Packets.PacketClass SMSG_WEATHER = new(Opcodes.SMSG_WEATHER);
         SMSG_WEATHER.AddInt32((int)Weather.CurrentWeather);
         SMSG_WEATHER.AddSingle(Weather.Intensity);
         SMSG_WEATHER.AddInt32(Weather.GetSound());
         client.Send(ref SMSG_WEATHER);
         SMSG_WEATHER.Dispose();
     }
 }
예제 #21
0
 private void SendActivateTaxiReply(ref WS_Network.ClientClass client, ActivateTaxiReplies reply)
 {
     Packets.PacketClass taxiFailed = new(Opcodes.SMSG_ACTIVATETAXIREPLY);
     try
     {
         taxiFailed.AddInt32((int)reply);
         client.Send(ref taxiFailed);
     }
     finally
     {
         taxiFailed.Dispose();
     }
 }
예제 #22
0
 public void On_CMSG_TAXIQUERYAVAILABLENODES(ref Packets.PacketClass packet, ref WS_Network.ClientClass client)
 {
     if (checked (packet.Data.Length - 1) >= 13)
     {
         packet.GetInt16();
         var guid = packet.GetUInt64();
         WorldServiceLocator._WorldServer.Log.WriteLine(LogType.DEBUG, "[{0}:{1}] CMSG_TAXIQUERYAVAILABLENODES [taxiGUID={2:X}]", client.IP, client.Port, guid);
         if (WorldServiceLocator._WorldServer.WORLD_CREATUREs.ContainsKey(guid) && ((uint)WorldServiceLocator._WorldServer.WORLD_CREATUREs[guid].CreatureInfo.cNpcFlags & 8u) != 0)
         {
             SendTaxiMenu(ref client.Character, guid);
         }
     }
 }
예제 #23
0
 public void SendInstanceMessage(ref WS_Network.ClientClass client, uint Map, int Time)
 {
     if (Time < 0)
     {
         Time = checked (-Time);
     }
     else if (Time <= 60 || Time >= 3600)
     {
         switch (Time)
         {
         }
     }
 }
예제 #24
0
 public void SendTutorialFlags(ref WS_Network.ClientClass client, ref WS_PlayerData.CharacterObject Character)
 {
     Packets.PacketClass SMSG_TUTORIAL_FLAGS = new Packets.PacketClass(Opcodes.SMSG_TUTORIAL_FLAGS);
     try
     {
         SMSG_TUTORIAL_FLAGS.AddByteArray(Character.TutorialFlags);
         client.Send(ref SMSG_TUTORIAL_FLAGS);
     }
     finally
     {
         SMSG_TUTORIAL_FLAGS.Dispose();
     }
 }
예제 #25
0
 public void Send_SMSG_SET_REST_START(ref WS_Network.ClientClass client, ref WS_PlayerData.CharacterObject Character)
 {
     Packets.PacketClass SMSG_SET_REST_START = new Packets.PacketClass(Opcodes.SMSG_SET_REST_START);
     try
     {
         SMSG_SET_REST_START.AddInt32(WorldServiceLocator._WS_Network.MsTime());
         client.Send(ref SMSG_SET_REST_START);
     }
     finally
     {
         SMSG_SET_REST_START.Dispose();
     }
 }
예제 #26
0
 public void On_CMSG_MOUNTSPECIAL_ANIM(ref Packets.PacketClass packet, ref WS_Network.ClientClass client)
 {
     WorldServiceLocator._WorldServer.Log.WriteLine(LogType.DEBUG, "[{0}:{1}] CMSG_MOUNTSPECIAL_ANIM", client.IP, client.Port);
     Packets.PacketClass response = new(Opcodes.SMSG_MOUNTSPECIAL_ANIM);
     try
     {
         response.AddPackGUID(client.Character.GUID);
         client.Character.SendToNearPlayers(ref response);
     }
     finally
     {
         response.Dispose();
     }
 }
예제 #27
0
        public static void MovementEvent(ref WS_Network.ClientClass client, float RunSpeed, float posX, float positionX, float posY, float positionY, float posZ, float positionZ, int sTime, int cTime)
        {
            WS_PlayerData.CharacterObject character = client.Character;
            SpeedHackViolation            sData;

            if (!SpeedHacks.Exists(obj => obj.Character.Equals(character.Name)))
            {
                sData = new SpeedHackViolation(client.Character.Name, cTime, sTime);
                SpeedHacks.Add(sData);
            }
            else
            {
                sData = SpeedHacks.Find(obj => obj.Character.Equals(character.Name));
            }
            sData.TriggerViolation(posX, positionX, posY, positionY, posZ, positionZ, sTime, cTime, RunSpeed);
            checked
            {
                if (sData.LastViolation != 0)
                {
                    sData.Violations += (int)sData.LastViolation;
                    WorldServiceLocator._WorldServer.Log.WriteLine(LogType.INFORMATION, "[AntiCheat] Player {0} triggered a speedhack violation. ({1}) {2}", client.Character.Name, sData.Violations, sData.LastMessage);
                    if (sData.Violations >= 10)
                    {
                        WorldServiceLocator._WorldServer.Log.WriteLine(LogType.USER, "[AntiCheat] Player {0} exceeded violation value. Taking action.", client.Character.Name);
                        client.Character.Logout();
                        SpeedHacks.Remove(sData);
                    }
                    return;
                }
                if (sData.Violations > 0)
                {
                    switch (sData.LastViolation)
                    {
                    case ViolationType.AC_VIOLATION_NONE:
                    case ViolationType.AC_VIOLATION_SPEEDHACK_TIME:
                    case ViolationType.AC_VIOLATION_MOVEMENT_Z:
                        sData.Violations--;
                        break;

                    case ViolationType.AC_VIOLATION_SPEEDHACK_MEM:
                        sData.Violations -= 0;
                        break;
                    }
                }
                if (sData.Violations < 0)
                {
                    sData.Violations = 0;
                }
            }
        }
예제 #28
0
 public void On_CMSG_TOGGLE_CLOAK(ref Packets.PacketClass packet, ref WS_Network.ClientClass client)
 {
     WorldServiceLocator._WorldServer.Log.WriteLine(LogType.DEBUG, "[{0}:{1}] CMSG_TOGGLE_CLOAK", client.IP, client.Port);
     if ((client.Character.cPlayerFlags & PlayerFlags.PLAYER_FLAGS_HIDE_CLOAK) != 0)
     {
         client.Character.cPlayerFlags &= ~PlayerFlags.PLAYER_FLAGS_HIDE_CLOAK;
     }
     else
     {
         client.Character.cPlayerFlags |= PlayerFlags.PLAYER_FLAGS_HIDE_CLOAK;
     }
     client.Character.SetUpdateFlag(190, (int)client.Character.cPlayerFlags);
     client.Character.SendCharacterUpdate();
 }
예제 #29
0
 public void On_CMSG_TUTORIAL_FLAG(ref Packets.PacketClass packet, ref WS_Network.ClientClass client)
 {
     checked
     {
         if (packet.Data.Length - 1 >= 9)
         {
             packet.GetInt16();
             var Flag = packet.GetInt32();
             WorldServiceLocator._WorldServer.Log.WriteLine(LogType.DEBUG, "[{0}:{1}] CMSG_TUTORIAL_FLAG [flag={2}]", client.IP, client.Port, Flag);
             client.Character.TutorialFlags[Flag / 8] = (byte)(client.Character.TutorialFlags[Flag / 8] + (1 << (7 - (Flag % 8))));
             client.Character.SaveCharacter();
         }
     }
 }
예제 #30
0
 public void On_CMSG_MAIL_MARK_AS_READ(ref Packets.PacketClass packet, ref WS_Network.ClientClass client)
 {
     checked
     {
         if (packet.Data.Length - 1 >= 17)
         {
             packet.GetInt16();
             var GameObjectGUID = packet.GetUInt64();
             var MailID         = packet.GetInt32();
             WorldServiceLocator._WorldServer.Log.WriteLine(LogType.DEBUG, "[{0}:{1}] CMSG_MAIL_MARK_AS_READ [MailID={2}]", client.IP, client.Port, MailID);
             var MailTime = (int)(WorldServiceLocator._Functions.GetTimestamp(DateAndTime.Now) + 259200L);
             WorldServiceLocator._WorldServer.CharacterDatabase.Update(string.Format("UPDATE characters_mail SET mail_read = 1, mail_time = {1} WHERE mail_id = {0} AND mail_read < 2;", MailID, MailTime));
         }
     }
 }