///////////////////////////////////////////////////////////////////////////////// // Move item to exchange slot (Will come when fixing exchange system). ///////////////////////////////////////////////////////////////////////////////// void ItemMoveToExhangePage(byte f_slot) { #region Move to exchange try { PlayerMgr sys = Helpers.GetInformation.GetPlayer(Character.Network.TargetID); if (Character.Network.Exchange.ItemList.Count < 12 && sys.GetFreeSlotMax() > (byte)Character.Network.Exchange.ItemList.Count) { ObjData.slotItem newitem = GetItem((uint)Character.Information.CharacterID, f_slot, 0); LoadBluesid(newitem.dbID); if (newitem.Amount <= ObjData.Manager.ItemBase[newitem.ID].Max_Stack) { Character.Network.Exchange.ItemList.Add(newitem); client.Send(Packet.Exchange_ItemPacket(Character.Information.UniqueID, 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) { Log.Exception("Exchange add item error: ", ex); } #endregion }
///////////////////////////////////////////////////////////////////////////////// // Remove Friends ///////////////////////////////////////////////////////////////////////////////// public void FriendRemoval() { try { //Read client packet data PacketReader reader = new PacketReader(PacketInformation.buffer); int target = reader.Int32(); reader.Close(); //Get player information PlayerMgr sys = Helpers.GetInformation.GetPlayerid(target); //Remove friend from our list query DB.query("DELETE FROM friends WHERE owner='" + Character.Information.CharacterID + "' AND friend_name='" + target + "'"); DB.query("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); Log.Exception(ex); } }
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Private Message Send /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// public void PrivateMessageSend() { try { ///////////////////////////////////////////////////////////////////////////////////// PacketReader Reader = new PacketReader(PacketInformation.buffer); ///////////////////////////////////////////////////////////////////////////////////// short touser = Reader.Int16(); string tousername = Reader.String(touser); short messagel = Reader.Int16(); string message = Reader.String(messagel); Reader.Close(); ///////////////////////////////////////////////////////////////////////////////////// int count = DB.GetRowsCount("SELECT * FROM character WHERE name='" + tousername + "'"); int charid = Convert.ToInt32(Convert.ToInt32(DB.GetData("SELECT id FROM character WHERE name='" + tousername + "'", "id"))); ///////////////////////////////////////////////////////////////////////////////////// if (count == 0)//Check username { client.Send(Packet.PrivateMessageMsg(1)); return; } if (count > 0)//Excisting username { DB ms = new DB("SELECT * FROM message WHERE receiver='" + tousername + "' ORDER BY idinfo DESC"); int msgcount = ms.Count(); PlayerMgr sys = Helpers.GetInformation.GetPlayerMainid(charid); if (msgcount == 0) { DB.query("INSERT INTO message (sender, receiver, message, status, time, idinfo) VALUES ('" + Character.Information.Name + "','" + tousername + "','" + message + "','0','10/10/2010 12:00:00 AM','0')"); client.Send(Packet.PrivateMessageMsg(2)); sys.Send(Packet.FriendData(sys.Character.Information.UniqueID, 5, tousername, Character, false)); } if (msgcount > 0) { int messagenewid = msgcount + 1; DB.query("INSERT INTO message (sender, receiver, message, status, time, idinfo) VALUES ('" + Character.Information.Name + "','" + tousername + "','" + message + "','0','10/10/2010 12:00:00 AM','" + Convert.ToByte(messagenewid) + "')"); client.Send(Packet.PrivateMessageMsg(2)); sys.Send(Packet.FriendData(sys.Character.Information.UniqueID, 5, tousername, Character, false)); } } } catch (Exception ex) { Log.Exception(ex); } }
public static void DeleteEffect_fb(object target, byte EffectSlot) { try { if (target.GetType().ToString() == "CLGameServer.PlayerMgr") // player { PlayerMgr sys = target as PlayerMgr; 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() == "CLGameServer.WorldMgr.Monsters") // mob { WorldMgr.Monsters os = target as WorldMgr.Monsters; 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.RunningSpeed *= 2; os.WalkingSpeed *= 2; //Set bool to false again os.Frostbite = false; os.Send(Packet.SetSpeed(os.UniqueID, os.WalkingSpeed, os.RunningSpeed)); } } catch (Exception ex) { Log.Exception(ex); } }
public 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 PlayerMgr TargetCharacter = Helpers.GetInformation.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 PlayerMgr guildmember = Helpers.GetInformation.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(OperationCode.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 DB.query("DELETE from guild_members where guild_member_id='" + TargetCharacter.Character.Information.CharacterID + "'"); //Update database Character.Network.Guild.TotalMembers -= 1; DB.query("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 } }
public static void GenerateEffect_fb(object target, int skillid) { // Get effects parameters int Power = ObjData.Manager.SkillBase[skillid].Properties1["fb"]; int Probability = ObjData.Manager.SkillBase[skillid].Properties2["fb"]; int Random = Rnd.Next(1, 100); byte slot; // if effect succeeded if (Random <= Probability) { if (target.GetType().ToString() == "CLGameServer.PlayerMgr") // player { PlayerMgr sys = target as PlayerMgr; 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() == "CLGameServer.WorldMgr.Monsters") // mob { WorldMgr.Monsters os = target as WorldMgr.Monsters; 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.RunningSpeed /= 2; os.WalkingSpeed /= 2; //Set our bool active os.Frostbite = true; os.Send(Packet.SetSpeed(os.UniqueID, os.WalkingSpeed, os.RunningSpeed)); } } }