public static void GameTurnFinishRequest(World.Network.WorldClient client, string packet) { if (client.Character.Fighter != null) { client.Character.Fighter.Team.Fight.FinishTurnRequest(client.Character.Fighter); } }
public void ShowPlayers(World.Network.WorldClient client) { string packet = "GM"; CharactersOnMap.ForEach(x => packet += "|+" + x.Character.Pattern.ShowCharacterOnMap); client.Send(packet); }
public void CallEventNpcResponse(World.Network.WorldClient client, int response) { lock (this.Scope) { try { if (!this.IsPlugin) { this.Scope.SetVariable("player", client); this.Scope.SetVariable("response", response); this.DoMethod("onPlayerNpcResponse(player, response)"); this.Scope.RemoveVariable("player"); this.Scope.RemoveVariable("response"); } } catch (Exception e) { if (this.Platform.showErrors) { Utilities.ConsoleStyle.Error("Can't call script : " + e.ToString()); } } } }
public void CallEventPlayerMovement(World.Network.WorldClient client, int oldCell, int newCell) { try { if (!this.IsPlugin) { this.Scope.SetVariable("player", client); this.Scope.SetVariable("oldCell", oldCell); this.Scope.SetVariable("newCell", newCell); this.DoMethod("onPlayerMovement(player, oldCell, newCell)"); this.Scope.RemoveVariable("player"); this.Scope.RemoveVariable("oldCell"); this.Scope.RemoveVariable("newCell"); } } catch (Exception e) { if (this.Platform.showErrors) { Utilities.ConsoleStyle.Error("Can't call script : " + e.ToString()); } } }
public static void InitDialog(World.Network.WorldClient client, string packet) { if (!client.Action.IsOccuped) { Database.Records.NpcPositionRecord Npc = client.Character.Map.Engine.GetNpc(int.Parse(packet.Substring(2))); if (Npc != null) { Database.Records.NpcDialogRecord Dialog = Helper.NpcHelper.GetDialog(Npc.Template.InitQuestion); if (Dialog != null) { client.State = Network.WorldClientState.OnDialog; client.Send("DCK" + int.Parse(packet.Substring(2))); client.Send("DQ" + Dialog.ID + "|" + Dialog.Responses.Replace(",", ";")); } else { client.Send("BN"); } } else { client.Send("BN"); } } else { client.Send("BN"); } }
public void CallEventEnterMap(World.Network.WorldClient client, int mapid, int cellid) { try { if (!this.IsPlugin) { this.Scope.SetVariable("player", client); this.Scope.SetVariable("mapid", mapid); this.Scope.SetVariable("cellid", cellid); this.DoMethod("onEnterMap(player, mapid, cellid)"); this.Scope.RemoveVariable("player"); this.Scope.RemoveVariable("mapid"); this.Scope.RemoveVariable("cellid"); } } catch (Exception e) { if (this.Platform.showErrors) { Utilities.ConsoleStyle.Error("Can't call script : " + e.ToString()); } } }
public static void GameReadyRequest(World.Network.WorldClient client, string packet) { if (client.Character.Fighter != null) { client.Character.Fighter.Team.Fight.ChangeReadyState(client.Character.Fighter, int.Parse(packet.Substring(2))); } }
public static void ShowFriends(World.Network.WorldClient client, string packet = "") { string friendPacket = "FL"; foreach (int i in client.AccountData.FriendsIDs) { if (Helper.AccountHelper.ExistAccountData(i)) { Database.Records.AccountDataRecord account = Helper.AccountHelper.GetAccountData(i); friendPacket += "|" + account.NickName; World.Network.WorldClient player = Helper.WorldHelper.GetClientByAccountNickName(account.NickName); if (player != null) { if (player.AccountData.FriendsIDs.Contains(client.AccountData.AccountID)) { friendPacket += player.Character.Pattern.CharacterToFriendsListKnow; } else { friendPacket += player.Character.Pattern.CharacterToFriendsListUnKnow; } } } } client.Send(friendPacket); }
public static void CallEventPlayerMovement(World.Network.WorldClient client, int oldCell, int newCell) { foreach (var script in Scripts) { script.CallEventPlayerMovement(client, oldCell, newCell); } }
public static void CallEventWinBattleVersusMonster(World.Network.WorldClient client, int mapid) { foreach (var script in Scripts) { script.CallEventWinBattleVersusMonster(client, mapid); } }
public static void CallEventEnterMap(World.Network.WorldClient client, int mapid, int cellid) { foreach (var script in Scripts) { script.CallEventEnterMap(client, mapid, cellid); } }
public static void CallEventPlayerSpeak(World.Network.WorldClient client, string message, string channel) { foreach (var script in Scripts) { script.CallEventPlayerSpeak(client, message, channel); } }
public void CallEventPlayerSpeak(World.Network.WorldClient client, string message, string channel) { try { if (!this.IsPlugin) { this.Scope.SetVariable("player", client); this.Scope.SetVariable("message", message); this.Scope.SetVariable("channel", channel); this.DoMethod("onPlayerSpeak(player, message, channel)"); this.Scope.RemoveVariable("player"); this.Scope.RemoveVariable("message"); this.Scope.RemoveVariable("channel"); } } catch (Exception e) { if (this.Platform.showErrors) { Utilities.ConsoleStyle.Error("Can't call script : " + e.ToString()); } } }
public static void UseItem(World.Network.WorldClient client, string packet) { int id = int.Parse(packet.Substring(2).Split('|')[0]); Database.Records.WorldItemRecord item = client.Character.Items.GetItem(id); Interop.Scripting.ScriptManager.CallScript("use_item", item.Template, client, item); }
public void ShowPlayer(World.Network.WorldClient client) { if (client.Character.Pattern.ShowCharacterOnMap != "") { _map.Send("GM|+" + client.Character.Pattern.ShowCharacterOnMap); } }
public static Database.Records.WorldItemRecord GenerateItem(World.Network.WorldClient client, int templateID, bool canGenerateMount = true) { try { Database.Records.ItemRecord template = Database.Cache.ItemCache.Cache.First(x => x.ID == templateID); Database.Records.WorldItemRecord item = new Database.Records.WorldItemRecord(); item.Template = templateID; item.Engine.Effects = template.Engine.GetRandomEffect(); item.Owner = client.Character.ID; item.Effects = item.Engine.StringEffect(); item.Position = -1; item.Quantity = 1; item.SaveAndFlush(); if (canGenerateMount) { Database.Records.MountTemplateRecord mount = Helper.MountHelper.GetMountTemplateByScrool(item.Template); if (mount != null) { Database.Records.WorldMountRecord newWMount = Game.Mounts.MountFactory.CreateMount(mount, item.ID, client.Character.ID); } } return(item); } catch (Exception e) { Utilities.ConsoleStyle.Error("Cant generate items : " + e.ToString()); return(null); } }
public PartyEngine(World.Network.WorldClient leader, World.Network.WorldClient invitedMember) { this.Leader = leader; Members = new List<World.Network.WorldClient>() { leader, invitedMember }; leader.Character.Party = this; invitedMember.Character.Party = this; RefreshParty(); }
public void ShowItemPrices(World.Network.WorldClient client, int id) { var a = new World.Game.AuctionHouses.AuctionHousePriceArray(this, id); a.MakeCompactPrices(); a.ShowPrices(client); client.Action.CurrentAuctionItem = a; }
public void HandleMoveItem(World.Network.WorldClient client, string packet) { //EMO+59|1|10000 string data = packet.Substring(4); char typeMove = packet[3]; string[] itemsInfos = data.Split('|'); var itemID = int.Parse(itemsInfos[0]); var quantity = int.Parse(itemsInfos[1]); switch (typeMove) { case '+': var price = int.Parse(itemsInfos[2]); if (client.Character.Items.HaveItemID(itemID)) { var item = client.Character.Items.GetItem(itemID); if (item != null) { if (quantity > 0 && item.Quantity >= quantity) { var ahi = new Database.Records.AuctionHouseItemRecord() { Owner = client.Account.ID, AuctionID = this.ID, ItemID = item.Template, Quantity = quantity, SellPrice = price, StartTime = 0, Stats = item.Engine.StringEffect(), }; Database.Cache.AuctionHouseItemsCache.Cache.Add(ahi); ahi.SaveAndFlush(); client.Character.Items.RemoveItem(item, quantity); client.Send("EmK+" + ahi.ToEML()); } } } break; case '-': var ahItem = this.GetItemForOwner(client.Account.ID).FirstOrDefault(x => x.ID == itemID); var genItem = World.Helper.ItemHelper.GenerateItem(ahItem.ItemID); genItem.Engine.Load(ahItem.Stats, genItem.GetTemplate.WeaponInfo); genItem.Owner = client.Character.ID; client.Character.AddItem(genItem, ahItem.Quantity); client.Send("EmK-" + ahItem.ID); Database.Cache.AuctionHouseItemsCache.Cache.Remove(ahItem); ahItem.DeleteAndFlush(); break; } }
public static void DropItem(World.Network.WorldClient client, string packet) { if (!Utilities.ConfigurationManager.GetBoolValue("EnableDropItems")) { client.Action.SystemMessage("Impossible de jeter des objets sur ce serveur, la fonction n'est pas activer !"); return; } string[] data = packet.Substring(2).Split('|'); int id = int.Parse(data[0]); int quantity = int.Parse(data[1]); if (client.Character.Map.Engine.GetDroppedItem(client.Character.CellID) == null) { Database.Records.WorldItemRecord playerItem = client.Character.Items.GetItem(id); if (playerItem != null) { if (quantity == playerItem.Quantity) { int itemPos = playerItem.Position; playerItem.Position = -1; //Delete the item if (itemPos != -1) { playerItem.Engine.Effects.ForEach(x => client.Character.Stats.ApplyEffect(x, true)); client.Action.RefreshCharacter(); client.Character.Stats.RefreshStats(); client.Action.RefreshRoleplayEntity(); client.Action.RefreshPods(); } client.Character.Items.RemoveItem(playerItem, playerItem.Quantity, false); client.Character.Map.Engine.AddNewDroppedItem(playerItem, client.Character.CellID); } else if (quantity < playerItem.Quantity) { //Remove quantity and create another object stack Database.Records.WorldItemRecord duplicatedItem = new Database.Records.WorldItemRecord() { Template = playerItem.Template, Quantity = quantity, Effects = playerItem.Effects, Position = -1, }; duplicatedItem.Engine.Load(duplicatedItem.Effects, duplicatedItem.GetTemplate.WeaponInfo); client.Character.Items.RemoveItem(playerItem, quantity); client.Character.Map.Engine.AddNewDroppedItem(duplicatedItem, client.Character.CellID); } client.Character.RefreshItemSet(); client.Action.RefreshCharacterJob(true); } } else { client.Send("BN"); } }
public static void GameFightPosition(World.Network.WorldClient client, string packet) { if (client.Character.Fighter != null) { if (client.Character.Fighter.Team.Fight.State == Game.Fights.Fight.FightState.PlacementsPhase) { client.Character.Fighter.Team.Fight.ChangePlayerPlace(client.Character.Fighter, int.Parse(packet.Substring(2))); } } }
public static void ReportingTicket(World.Network.WorldClient client, string packet) { var data = packet.Split('|'); var cate = data[1]; var content = data[2]; var report = new Reporting(client.Character.Nickname, cate, content); Reportings.Add(report); }
public static void SendOperatorOnline(World.Network.WorldClient client) { var packet = new StringBuilder("100MJ|"); var names = new List <string>(); World.Helper.WorldHelper.GetClientsArray.ToList().ForEach(x => names.Add(x.Character.Nickname)); packet.Append(string.Join("|", names)); names.Clear(); client.Send(packet.ToString()); }
public static void OnRequestUse(World.Network.WorldClient client, int cell) { if (cell == client.Character.CellID) { OpenZaapPanel(client); } else { client.State = Network.WorldClientState.OnRequestZaap; } }
public void RemovePlayer(World.Network.WorldClient client) { try { Players.HidePlayer(client); Players.CharactersOnMap.Remove(client); } catch (Exception e) { Utilities.ConsoleStyle.Error("Can't hide player : " + e.ToString()); } }
public void ShowMonstersGroup(World.Network.WorldClient client) { try { this.Spawner.GroupsOnMap.ForEach(x => client.Send("GM" + x.CatchedPattern)); } catch (Exception e) { Utilities.ConsoleStyle.Error("Can't show fights : " + e.ToString()); } }
public static void WantBuyObject(World.Network.WorldClient client, int id) { if (client.Character != null) { Database.Records.ShopItemRecord item = Helper.ShopHelper.FindShopItem(id); if (Communication.Realm.Communicator.Server.MainRealm != null) { if (item != null) { int price = item.NormalPrice; if (item.Vip == 1) { if (client.Account.Vip != 1) { client.Action.SystemMessage("Vous devez etre VIP vous acheter cette objet"); return; } } if (client.Account.Points >= price) { Database.Records.ItemRecord template = Database.Cache.ItemCache.Cache.FirstOrDefault(x => x.ID == item.TemplateID); if (template != null) { client.Account.Points -= price; Communication.Realm.Communicator.Server.MainRealm.SendMessage(new Communication.Realm.Packet.ClientShopPointUpdateMessage(client.Account.Username, client.Account.Points)); Database.Records.WorldItemRecord gItem = Helper.ItemHelper.GenerateItem(client, template.ID); if (Helper.ItemHelper.CanCreateStack(gItem.Template)) { client.Character.Items.AddItem(gItem, false, 1); } else { client.Character.Items.AddItem(gItem, true, 1); } Logger.WriteLine("Le compte '" + client.Account.Username + "' a acheter un objet a " + price + " points (" + template.Name + ") a " + DateTime.Now.ToString()); client.Action.SystemMessage("<b>Felicitations !</b> L'objet <i>" + template.Name + "</i> est desormais dans votre inventaire ! Il vous reste <b>" + client.Account.Points + "</b> " + Utilities.ConfigurationManager.GetStringValue("ShopPointName")); } } else { client.Action.SystemMessage("Il vous manque <b>" + (price - client.Account.Points) + "</b> " + Utilities.ConfigurationManager.GetStringValue("ShopPointName") + " pour acheter ceci !"); } } else { client.Action.SystemMessage("L'achat <b>n" + id + "</b> n'existe pas !"); } } else { client.Action.SystemMessage("Le serveur de connexion n'est pas disponible pour enregistrer votre achat, veuilliez essayer ulterieurement !"); } } }
public PartyEngine(World.Network.WorldClient leader, World.Network.WorldClient invitedMember) { this.Leader = leader; Members = new List <World.Network.WorldClient>() { leader, invitedMember }; leader.Character.Party = this; invitedMember.Character.Party = this; RefreshParty(); }
public static void HandleEmoteRequest(World.Network.WorldClient client, string packet) { var emoteID = int.Parse(packet.Substring(2)); switch (emoteID) { case 1: //Sit client.Action.StartAutoRegen(); break; } client.Send("eUK" + client.Character.ID + "|" + emoteID); }
public static void RenameMount(World.Network.WorldClient client, string packet) { if (client.Character.Mount != null) { if (packet.Length < 20) { client.Character.Mount.Name = packet.Substring(2); client.Character.Mount.SaveAndFlush(); } client.Action.SendMountPanel(); } }
public static void CloseTicket(World.Network.WorldClient client) { if (Tickets.ContainsKey(client.Character.Nickname)) { Tickets.Remove(client.Character.Nickname); client.Action.SystemMessage("Votre ticket a ete supprimer !"); } else { client.Action.SystemMessage("Vous n'avez aucun ticket en attente !"); } }
public void SelectRandomOwner() { Leader = Members[Utilities.Basic.Rand(0, Members.Count - 1)]; }
public ConsoleAPI(World.Network.WorldClient client) { this.self = client; }