Send() публичный Метод

public Send ( List list, byte buff ) : void
list List
buff byte
Результат void
Пример #1
0
        /////////////////////////////////////////////////////////////////////////////////
        // Move item to exchange slot (Will come when fixing exchange system).
        /////////////////////////////////////////////////////////////////////////////////
        void ItemMoveToExhangePage(byte f_slot)
        {
            #region Move to exchange
            try
            {
                Systems sys = GetPlayer(Character.Network.TargetID);
                if (Character.Network.Exchange.ItemList.Count < 12 && sys.GetFreeSlotMax() > (byte)Character.Network.Exchange.ItemList.Count)
                {
                    Global.slotItem newitem = GetItem((uint)Character.Information.CharacterID, f_slot, 0);

                    LoadBluesid(newitem.dbID);
                    if (newitem.Amount <= Data.ItemBase[newitem.ID].Max_Stack)
                    {
                        Character.Network.Exchange.ItemList.Add(newitem);

                        client.Send(Packet.Exchange_ItemPacket(this.Character.Information.UniqueID, this.Character.Network.Exchange.ItemList, true));
                        sys.Send(Packet.Exchange_ItemPacket(sys.Character.Information.UniqueID, sys.Character.Network.Exchange.ItemList, true));

                        client.Send(Packet.Exchange_ItemSlot(4, f_slot));
                        sys.Send(Packet.Exchange_ItemSlot(4, f_slot));
                    }
                    else
                    {
                        return;
                    }
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("Exchange add item error: {0}", ex);
            }
            #endregion
        }
Пример #2
0
        /////////////////////////////////////////////////////////////////////////////////
        // Remove Friends
        /////////////////////////////////////////////////////////////////////////////////
        void FriendRemoval()
        {
            try
            {
                //Read client packet data
                PacketReader reader = new PacketReader(PacketInformation.buffer);
                int          target = reader.Int32();
                reader.Close();
                //Get player information
                Systems sys = GetPlayerid(target);

                //Remove friend from our list query
                MsSQL.UpdateData("DELETE FROM friends WHERE owner='" + Character.Information.CharacterID + "' AND friend_name='" + target + "'");
                MsSQL.UpdateData("DELETE FROM friends WHERE owner='" + target + "' AND friend_name='" + Character.Information.CharacterID + "'");

                //Remove friend from our list packet
                client.Send(Packet.FriendData(target, 3, "", Character, false));
                client.Send(Packet.FriendRemovalTarget(target));
                //Remove friend from friend id packet
                if (sys != null)
                {
                    sys.Send(Packet.FriendData(sys.Character.Information.UniqueID, 3, "", Character, false));
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("Friend removal error {0}", ex);
                Systems.Debugger.Write(ex);
            }
        }
Пример #3
0
        ///////////////////////////////////////////////////////////////////////////
        // Remove frostbite
        ///////////////////////////////////////////////////////////////////////////
        public static void DeleteEffect_fb(object target, byte EffectSlot)
        {
            try
            {
                if (target.GetType().ToString() == "DarkEmu_GameServer.Systems") // player
                {
                    Systems sys = target as Systems;

                    sys.Send(Packet.EffectUpdate(sys.Character.Information.UniqueID, sys.Character.Action.DeBuff.Effect.EffectID[EffectSlot], false));

                    sys.Character.Action.DeBuff.Effect.EffectID[EffectSlot] = 0;
                    sys.Character.Action.DeBuff.Effect.SkillID[EffectSlot]  = 0;

                    sys.Character.Speed.AttackSpeedModifier = 1;

                    sys.Character.Speed.RunSpeed     *= 2;
                    sys.Character.Speed.WalkSpeed    *= 2;
                    sys.Character.Speed.BerserkSpeed *= 2;

                    sys.Send(Packet.SetSpeed(sys.Character.Information.UniqueID, sys.Character.Speed.WalkSpeed, sys.Character.Speed.RunSpeed));
                }
                else if (target.GetType().ToString() == "DarkEmu_GameServer.obj") // mob
                {
                    obj os = target as obj;

                    os.Send(Packet.EffectUpdate(os.UniqueID, os.DeBuff.Effect.EffectID[EffectSlot], false));

                    os.DeBuff.Effect.EffectID[EffectSlot] = 0;
                    os.DeBuff.Effect.SkillID[EffectSlot]  = 0;

                    // attack speed
                    os.AttackSpeed = 1;

                    // movement speed
                    os.SpeedRun  *= 2;
                    os.SpeedWalk *= 2;
                    //Set bool to false again
                    os.Frostbite = false;

                    os.Send(Packet.SetSpeed(os.UniqueID, os.SpeedWalk, os.SpeedRun));
                }
            }
            catch (Exception ex)
            {
                Systems.Debugger.Write(ex);
            }
        }
Пример #4
0
        /*
         * public static void StartEffectDamage(int intval, int HitPower, byte e_index, object target)
         * {
         *  try
         *  {
         *      if (target.sys.Character.Action.DeBuff.Effect.EffectImpactTimer[e_index] != null) target.sys.Character.Action.DeBuff.Effect.EffectImpactTimer[e_index].Dispose();
         *
         *      target.sys.Character.Action.DeBuff.Effect.EffectImpactTimer[e_index] = new Timer(
         *          new TimerCallback(
         *              delegate(object e)
         *              {
         *                  if (target.type == true) // player
         *                  {
         *                      if (!target.sys.Character.State.Die)
         *                      {
         *                          target.HP(HitPower);
         *                          target.sys.Send(Packet.Effects2Dmg(target.sys.Character.Information.UniqueID, HitPower));
         *                      }
         *                      else return;
         *                  }
         *                  else if (target.type == false) // mob
         *                  {
         *                      if (!target.os.Die)
         *                      {
         *                          target.HP(HitPower);
         *                          target.os.Send(Packet.Effects2Dmg(target.ID, HitPower));
         *                      }
         *                      else return;
         *                  }
         *              }
         *      ), null, 0, intval);
         *  }
         *  catch (Exception ex)
         *  {
         *      deBug.Write(ex);
         *      Console.WriteLine("StartEffectDamage() Error {0}", ex);
         *  }
         * }
         */
        ///////////////////////////////////////////////////////////////////////////
        // Shock state
        ///////////////////////////////////////////////////////////////////////////
        public static void GenerateEffect_es(object target, int skillid)
        {
            // Get effects parameters
            int Power       = Data.SkillBase[skillid].Properties1["es"];
            int Probability = Data.SkillBase[skillid].Properties2["es"];

            int Random = Seed.Next(1, 100);

            byte slot;

            // if effect succeeded
            if (Random <= Probability)
            {
                if (target.GetType().ToString() == "DarkEmu_GameServer.Systems") // player
                {
                    Systems sys = target as Systems;

                    if (sys.Character.State.Die == true)
                    {
                        return;
                    }

                    slot = sys.DeBuffGetFreeSlot();
                    sys.Character.Action.DeBuff.Effect.EffectID[slot] = EffectNumbers.SHOCKED;
                    sys.Character.Action.DeBuff.Effect.SkillID[slot]  = skillid;

                    sys.StartEffectTimer(Power * 100, slot);
                    sys.Send(Packet.EffectUpdate(sys.Character.Information.UniqueID, EffectNumbers.SHOCKED, true));

                    // Timer for burn state
                }
                else if (target.GetType().ToString() == "DarkEmu_GameServer.obj") // mob
                {
                    obj os = target as obj;

                    if (os.Die == true)
                    {
                        return;
                    }

                    slot = os.DeBuffGetFreeSlot();
                    os.DeBuff.Effect.EffectID[slot] = EffectNumbers.SHOCKED;
                    os.DeBuff.Effect.SkillID[slot]  = skillid;

                    os.StartEffectTimer(Power * 100, slot);
                    os.Send(Packet.EffectUpdate(os.UniqueID, EffectNumbers.SHOCKED, true));

                    // Burn timer
                    // Add (character details).
                }
            }
        }
Пример #5
0
        ///////////////////////////////////////////////////////////////////////////
        // Frostbite state
        ///////////////////////////////////////////////////////////////////////////
        #region Frost Bite
        public static void GenerateEffect_fb(object target, int skillid)
        {
            // Get effects parameters
            int Power       = Data.SkillBase[skillid].Properties1["fb"];
            int Probability = Data.SkillBase[skillid].Properties2["fb"];

            int Random = Seed.Next(1, 100);

            byte slot;


            // if effect succeeded
            if (Random <= Probability)
            {
                if (target.GetType().ToString() == "DarkEmu_GameServer.Systems") // player
                {
                    Systems sys = target as Systems;

                    if (sys.Character.State.Die == true)
                    {
                        return;
                    }

                    slot = sys.DeBuffGetFreeSlot();
                    sys.Character.Action.DeBuff.Effect.EffectID[slot] = EffectNumbers.FROSTBITE;
                    sys.Character.Action.DeBuff.Effect.SkillID[slot]  = skillid;

                    sys.StartEffectTimer(Power * 100, slot);
                    sys.Send(Packet.EffectUpdate(sys.Character.Information.UniqueID, EffectNumbers.FROSTBITE, true));

                    // attack speed
                    sys.Character.Speed.AttackSpeedModifier = 1.5;

                    sys.Character.Speed.RunSpeed     /= 2;
                    sys.Character.Speed.WalkSpeed    /= 2;
                    sys.Character.Speed.BerserkSpeed /= 2;

                    sys.Send(Packet.SetSpeed(sys.Character.Information.UniqueID, sys.Character.Speed.WalkSpeed, sys.Character.Speed.RunSpeed));
                }
                else if (target.GetType().ToString() == "DarkEmu_GameServer.obj") // mob
                {
                    obj os = target as obj;

                    if (os.Die == true)
                    {
                        return;
                    }

                    slot = os.DeBuffGetFreeSlot();
                    os.DeBuff.Effect.EffectID[slot] = EffectNumbers.FROSTBITE;
                    os.DeBuff.Effect.SkillID[slot]  = skillid;
                    //target.os.DeBuff.Effect.EffectPower[slot] = Power;

                    os.StartEffectTimer(Power * 100, slot);

                    os.Send(Packet.EffectUpdate(os.UniqueID, EffectNumbers.FROSTBITE, true));

                    // attack speed
                    os.AttackSpeed = 1.5;

                    // movement speed
                    os.SpeedRun  /= 2;
                    os.SpeedWalk /= 2;

                    //Set our bool active
                    os.Frostbite = true;

                    os.Send(Packet.SetSpeed(os.UniqueID, os.SpeedWalk, os.SpeedRun));
                }
            }
        }
Пример #6
0
        public static void SetPartyMemberExp(Systems ch, long expamount, short stat, long sp)
        {
            try
            {
                ch.Character.Information.XP += expamount;
                bool level = false;
                while (ch.Character.Information.XP >= Data.LevelData[ch.Character.Information.Level])
                {
                    ch.Character.Information.XP -= Data.LevelData[ch.Character.Information.Level];
                    if (ch.Character.Information.XP < 1) ch.Character.Information.XP = 0;
                    stat += 3;
                    ch.Character.Information.Attributes += 3;
                    ch.Character.Information.Level++;
                    ch.Character.Stat.Intelligence++;
                    ch.Character.Stat.Strength++;
                    ch.UpdateIntelligenceInfo(1);
                    ch.UpdateStrengthInfo(1);
                    ch.SetStat();
                    level = true;
                }
                if (level)
                {
                    if (ch.Character.Network.Guild.Guildid != 0)
                    {
                        // 1 question again where we  set info to databse at lvlup? ah got it :)
                        ch.Character.Network.Guild.Send(Packet.GuildUpdate(ch.Character, 8, 0, 0, 0));

                        // set new amount to every guild members guild class
                        foreach (int m in ch.Character.Network.Guild.Members)
                        {
                            int targetindex = ch.Character.Network.Guild.MembersInfo.FindIndex(i => i.MemberID == m);
                            if (ch.Character.Network.Guild.MembersInfo[targetindex].Online)
                            {
                                Systems sys = Systems.GetPlayer(m);

                                // here comes the messy way
                                Global.guild_player mygp = new Global.guild_player();
                                int myindex = 0;
                                foreach (Global.guild_player gp in sys.Character.Network.Guild.MembersInfo)
                                {
                                    if (gp.MemberID == ch.Character.Information.CharacterID)
                                    {
                                        mygp = gp;
                                        mygp.Level = ch.Character.Information.Level;
                                        break;
                                    }
                                    myindex++;
                                }
                                sys.Character.Network.Guild.MembersInfo[myindex] = mygp;
                            }
                        }
                    }
                    ch.Send(Packet.Player_LevelUpEffect(ch.Character.Information.UniqueID));
                    ch.client.Send(Packet.Player_getExp(ch.Character.Information.UniqueID, expamount, sp, stat));
                    ch.SavePlayerInfo();
                }
                else
                {
                    ch.client.Send(Packet.Player_getExp(ch.Character.Information.UniqueID, expamount, sp, 0));
                    ch.SavePlayerExperince();
                }
            }
            catch (Exception ex)
            {
                Systems.Debugger.Write(ex);
            }
        }
Пример #7
0
 void KickFromGuild()
 {
     //Wrap our function inside a catcher
     try
     {
         //Open a new packet reader
         PacketReader Reader = new PacketReader(PacketInformation.buffer);
         //Read short value lenght of name below
         short CharacterNameLen = Reader.Int16();
         //Read string charactername
         string CharacterName = Reader.String(CharacterNameLen);
         //Close packet reader
         Reader.Close();
         //Get player information
         Systems TargetCharacter = GetPlayerName(CharacterName);
         //Send required packets to network
         foreach (int member in Character.Network.Guild.Members)
         {
             //Make sure member s not null
             if (member != 0)
             {
                 //Get information for the guildmember
                 Systems guildmember = GetPlayerMainid(member);
                 //Make sure the guildmember isnt null
                 if (guildmember != null)
                 {
                     //Make sure the kicked member does not receive the packet
                     if (guildmember.Character.Information.CharacterID != TargetCharacter.Character.Information.CharacterID)
                     {
                         guildmember.client.Send(Packet.GuildUpdate(TargetCharacter.Character, 7, 0, 0, 0));
                     }
                 }
             }
         }
         //Send update packet to the kicked player
         TargetCharacter.client.Send(Packet.GuildUpdate(TargetCharacter.Character, 7, 0, 0, 0));
         //Send guild kick message packet to the kicked player
         PacketWriter Writer = new PacketWriter();
         //Add opcode
         Writer.Create(Systems.SERVER_GUILD_KICK);
         //Add static byte 1
         Writer.Byte(1);
         //Send packet to kicked member
         TargetCharacter.client.Send(Writer.GetBytes());
         //Send guildkick visual packet update to kicked player
         TargetCharacter.Send(Packet.GuildKick(TargetCharacter.Character.Information.UniqueID));
         //Remove the player from database
         MsSQL.UpdateData("DELETE from guild_members where guild_member_id='" + TargetCharacter.Character.Information.CharacterID + "'");
         //Update database
         Character.Network.Guild.TotalMembers -= 1;
         MsSQL.InsertData("UPDATE guild SET guild_members_t='" + Character.Network.Guild.TotalMembers + "' WHERE guild_name='" + Character.Network.Guild.Name + "'");
         TargetCharacter.CleanUp(TargetCharacter);
     }
     //Catch bad exception errors
     catch (Exception ex)
     {
         //Write information to the console
         Console.WriteLine("Guild Kick Error: {0}", ex);
         //Write information to the debug log
         Systems.Debugger.Write(ex);
     }
 }
Пример #8
0
 void PrivateMessageSend()
 {
     try
     {
         //Create new packet reader for reading packet data
         PacketReader Reader = new PacketReader(PacketInformation.buffer);
         //Read lenght of charactername we send the message to
         short ToCharacterLen = Reader.Int16();
         //Read the name of the character we send the message to
         string ToCharacter = Reader.String(ToCharacterLen);
         //Read lenght of message characters
         short MessageLen = Reader.Int16();
         //Read message
         string Message = Reader.String(MessageLen);
         //Close packet reader
         Reader.Close();
         //Create new mssql query for sending and checking
         MsSQL ms = new MsSQL("SELECT * FROM character WHERE name='" + ToCharacter + "'");
         //Check if the player exists
         int PlayerExists = ms.Count();
         //If the player exists
         if (PlayerExists > 0)
         {
             //First get details of the player we send the message to.
             Systems sys = GetPlayerName(ToCharacter);
             //Make sure we dont get a null error
             if (sys.Character != null)
             {
                 //Check how many messages the player has if inbox is full or not
                 int TargetMessageCount = MsSQL.GetRowsCount("SELECT * FROM message WHERE receiver='" + sys.Character.Information.CharacterID + "'");
                 //If less then 50 we continue
                 if (TargetMessageCount < 50)
                 {
                     //Set temp int to character data for new message order
                     sys.Character.Information.MessageCount = TargetMessageCount;
                     //Insert new message into the database
                     MsSQL.InsertData("INSERT INTO message (sender, receiver, message, status, time) VALUES ('" + Character.Information.Name + "','" + ToCharacter + "','" + Message + "','0','" + DateTime.Now + "')");
                     //Send packet message has been send to our client
                     client.Send(PrivateMessageRespond(2));
                     //Send packet to receiver information new message has arrived
                     sys.Send(Packet.FriendData(sys.Character.Information.UniqueID, 5, ToCharacter, Character, false));
                 }
                 //If inbox is full
                 else
                 {
                     //Send message to sender and receiver inbox full
                     client.Send(PrivateMessageRespond(3));
                     sys.client.Send(PrivateMessageRespond(3));
                 }
             }
         }
         //If player doesn't exist
         else
         {
             //Send packet message failed to send to our client.
             client.Send(PrivateMessageRespond(1));
         }
     }
     //Catch any bad exception errors
     catch (Exception ex)
     {
         //Write information to the console
         Console.WriteLine("Error sending messages : {0}" + ex);
         //Write info to the debug logger.
         Systems.Debugger.Write(ex);
     }
 }