private void BuyLot(GamePlayer player, byte response) { if (response != 0x01) { return; } lock (DatabaseItem) // Mannen 10:56 PM 10/30/2006 - Fixing every lock(this) { if (!string.IsNullOrEmpty(DatabaseItem.OwnerID)) { return; } if (HouseMgr.GetHouseNumberByPlayer(player) != 0 && player.Client.Account.PrivLevel != (int)ePrivLevel.Admin) { ChatUtil.SendMerchantMessage(player, "You already own another lot or house (Number " + HouseMgr.GetHouseNumberByPlayer(player) + ")."); return; } long totalCost = HouseTemplateMgr.GetLotPrice(DatabaseItem); if (player.RemoveMoney(totalCost, "You just bought this lot for {0}.", eChatType.CT_Merchant, eChatLoc.CL_SystemWindow)) { InventoryLogging.LogInventoryAction(player, this, eInventoryActionType.Merchant, totalCost); DatabaseItem.LastPaid = DateTime.Now; DatabaseItem.OwnerID = player.ObjectId; CreateHouse(player, 0); } else { ChatUtil.SendMerchantMessage(player, "You dont have enough money!"); } } }
public static void InitWorldCommands() { API.RegisterCommand("wanted", new Action <int, List <object>, string>((src, args, raw) => { var argList = args.Select(o => o.ToString()).ToList(); if (argList.Any() && int.TryParse(argList[0], out int level)) { API.SetMaxWantedLevel(level); ChatUtil.SendMessageToClient("[WantedLevel]", "Max wanted level set to " + level, 255, 255, 255); } } ), false); API.RegisterCommand("wanted2", new Action <int, List <object>, string>((src, args, raw) => { var argList = args.Select(o => o.ToString()).ToList(); if (argList.Any() && int.TryParse(argList[0], out int level)) { Game.WantedMultiplier = 0; ChatUtil.SendMessageToClient("[WantedLevel]", "Wanted multiplier set to " + level, 255, 255, 255); } } ), false); API.RegisterCommand("announce", new Action <int, List <object> >((src, args) => { var argList = args.Select(o => o.ToString()).ToArray(); Debug.WriteLine("1"); string message = string.Join(" ", argList); Debug.WriteLine("2" + message); TriggerServerEvent("serverAnnouncement", message); Debug.WriteLine("3"); } ), false); }
private static void HouseUpgradeDialog(GamePlayer player, byte response) { if (response != 0x01) { return; } var itemWeak = player.TempProperties.getProperty <WeakReference>(DeedWeak, new WeakRef(null)); player.TempProperties.removeProperty(DeedWeak); var item = (InventoryItem)itemWeak.Target; var house = (House)player.TempProperties.getProperty <object>(TargetHouse, null); player.TempProperties.removeProperty(TargetHouse); if (house == null) { ChatUtil.SendSystemMessage(player, "No House selected!"); return; } if (item == null || item.SlotPosition == (int)eInventorySlot.Ground || item.OwnerID == null || item.OwnerID != player.InternalID) { ChatUtil.SendSystemMessage(player, "This does not work without a House Deed."); return; } if (HouseMgr.UpgradeHouse(house, item)) { player.Inventory.RemoveItem(item); InventoryLogging.LogInventoryAction(player, $"(HOUSE;{house.HouseNumber})", eInventoryActionType.Other, item.Template, item.Count); } }
public override bool HandleCommand(ulong userId, string[] words) { try { MyObjectBuilder_Faction currentfaction; currentfaction = Utility.Faction.getFaction(Utility.Faction.getFactionID(userId)); foreach (MyObjectBuilder_FactionMember currentmember in currentfaction.Members) { if (currentmember.IsLeader == true && currentmember.PlayerId == PlayerMap.Instance.GetPlayerIdsFromSteamId(userId).First())//currentmember.isleader(currentfaction) { string output = ""; output = Utility.Shop.Shop.getShopList(userId); ChatUtil.DisplayDialog(userId, "Faction Store", "Spend FP Here!", output); break; } else if (currentmember.PlayerId == PlayerMap.Instance.GetPlayerIdsFromSteamId(userId).First()) { ChatUtil.SendPrivateChat(userId, "You do not have Permission to use this command."); } } } catch (NullReferenceException) { log.Info(string.Format("Error getting shop list nullreferenceexception")); } return(true); }
/// <summary> /// Called on every timer tick /// </summary> protected override void OnTick() { var player = (GamePlayer)m_actionSource; switch (_enter) { case 0: player.LeaveHouse(); break; case 1: if (!player.IsWithinRadius(_house, WorldMgr.VISIBILITY_DISTANCE) || (player.CurrentRegionID != _house.RegionID)) { ChatUtil.SendSystemMessage(player, string.Format("You are too far away to enter house {0}.", _house.HouseNumber)); return; } // make sure player can enter if (_house.CanEnterHome(player)) { player.CurrentHouse = _house; _house.Enter(player); } else { ChatUtil.SendSystemMessage(player, string.Format("You can't enter house {0}.", _house.HouseNumber)); return; } break; } }
public virtual void DisplaySyntax(GameClient client, string subcommand1, string subcommand2) { if (client == null || !client.IsPlaying) { return; } var attrib = (CmdAttribute[])GetType().GetCustomAttributes(typeof(CmdAttribute), false); if (attrib.Length == 0) { return; } foreach (string sentence in attrib[0].Usage) { string[] words = sentence.Split(new[] { ' ' }, 4); if (words.Length >= 3 && words[1].Equals(subcommand1) && words[2].Equals(subcommand2)) { ChatUtil.SendSystemMessage(client, sentence, null); } } return; }
public static bool transferFP(ulong userID, string factiontag, int amount) { if (amount < 0) { ChatUtil.SendPrivateChat(userID, "Please enter a positive value"); return(false); } if (Faction.getFactionIDfromTag(factiontag) != 0) { if (FactionPoints.RemoveFP((ulong)Faction.getFactionID(userID), amount) == true) { FactionPoints.AddFP(Faction.getFactionIDfromTag(factiontag), amount); return(true); } else { return(false); } } else { ChatUtil.SendPrivateChat(userID, "Factionx tag does not exist"); return(false); } }
public override bool HandleCommand(ulong userId, string[] words) { MyObjectBuilder_Faction currentfaction; try { currentfaction = Faction.getFaction(Faction.getFactionID(userId)); } catch (NullReferenceException) { ChatUtil.SendPrivateChat(userId, "Faction has 0 FactionPoints"); return false; } int currentFP = FactionPoints.getFP(Convert.ToUInt64( Faction.getFactionID(userId))); if (currentFP != -1) { ChatUtil.SendPrivateChat(userId, "Faction Currently has " + currentFP + " FactionPoints."); } else { ChatUtil.SendPrivateChat(userId, "Faction does not exist."); } return true; }
/// <summary> /// Initializes a new instance of the <see cref="DialPad"/> class. /// </summary> public DialPad(ChatUtil chatUtil) { InitializeComponent(); _chatUtil = chatUtil; this.DataContext = _chatUtil; txtNumbers.Focus(); _chatUtil.Contacts.Clear(); _chatUtil.ContactsFilter.Clear(); _chatUtil.DialedNumbers = string.Empty; MenuItem mnuItem = new MenuItem(); mnuItem.Header = "Dial"; mnuItem.VerticalContentAlignment = VerticalAlignment.Center; mnuItem.Height = 18; mnuItem.Background = System.Windows.Media.Brushes.Transparent; mnuItem.Icon = new System.Windows.Controls.Image { Height = 12, Width = 12, Source = _chatDataContext.GetBitmapImage(new Uri("/Agent.Interaction.Desktop;component/Images/Voice.Short.png", UriKind.Relative)) }; mnuItem.Click += new RoutedEventHandler(mnuItem_Click); _phoneBookMenu.Items.Add(mnuItem); if (_chatUtil.DialedNumbers.Length >= 9 && _chatUtil.ModifiedTextSize != 0) { txtNumbers.FontSize = _chatUtil.ModifiedTextSize; } Loaded += (s, e) => { Window.GetWindow(this) .Closing += (s1, e1) => Somewhere(); }; if (ConfigContainer.Instance().AllKeys.Contains("voice.enable.phonebook.double-click-to-call") && ((string)ConfigContainer.Instance().GetValue("voice.enable.phonebook.double-click-to-call")).ToLower().Equals("true")) { dgvContact.MouseDoubleClick += new MouseButtonEventHandler(dgvContact_MouseDoubleClick); } }
public async Task ProcessAsync(IDialogContext context, LuisResult result) { await context.PostAsync("O Krav Maga é a única luta reconhecida mundialmente como arte de defesa pessoal e não como arte marcial. A concepção do Krav Maga revela um caminho que permite qualquer um exercer o direito à vida, mesmo no cenário violento que nos rodeia.") .ContinueWith(task => ChatUtil.Typing(context, 2000)) .ContinueWith(task => context.PostAsync("Não há regras ou competições, pois sua técnica visa à legítima defesa em situações de perigo real. Com respostas simples, rápidas e objetivas para situações de violência do dia a dia, mostra ao cidadão comum como se defender, independentemente de condicionamento físico, idade ou sexo.")); context.Done <string>(null); }
public async Task ProcessAsync(IDialogContext context, LuisResult result) { await context.PostAsync($"Eu ainda não tenho um nome! Mas veja o que consigo fazer:{ChatUtil.NewLine}{ChatUtil.GetBotCapabilitiesMessage()}") .ContinueWith(task => ChatUtil.Typing(context, 500)) .ContinueWith(task => context.PostAsync($"Além disso, fui construído sob a plataforma de bots da Microsoft, depois dá uma olhadinha no meu site:{ChatUtil.NewLine}https://dev.botframework.com/")); context.Done <string>(null); }
public static void InitAllChatCommands() { PlayerCommands.InitPlayerPedCommands(); VehicleCommands.InitVehicleCommands(); WorldCommands.InitWorldCommands(); ChatUtil.RemoveAllChatSuggestions(); }
private void ListCharacters(dynamic charactersList) //List<List<object>> { Debug.WriteLine("Listing characters"); ChatUtil.SendMessageToClient("Characters", "List of all your characters", 0, 0, 255); foreach (List <object> character in (List <object>)charactersList) { ChatUtil.SendMessageToClient("Character", "#" + character[0].ToString() + " " + (string)character[1] + " " + (string)character[2], 0, 0, 255); } }
public void Execute(IRocketPlayer caller, string[] command) { foreach (var player in Provider.clients.Select(UnturnedPlayer.FromSteamPlayer)) { player.MaxSkills(); } ChatUtil.Broadcast(Plugin.Instance.Translate("MAX_SKILLS")); }
protected void SendMessage(string translationKey, params object[] args) { var message = Plugin.Instance.Translate("VOTE_CHAT_FORMAT") .Replace("{color}", $"<color={Settings.Color}>") .Replace("{/color}", "</color>") .Replace("{vote}", $"{Settings.Name}{(Arguments.Any() ? " " + string.Join(" ", Arguments) : "")}") .Replace("{text}", Plugin.Instance.Translate(translationKey, args)); ChatUtil.Broadcast(message, Settings.Icon, Color.white); }
public virtual bool OnPlayerSell(GamePlayer player, InventoryItem item) { if (!item.IsDropable) { ChatUtil.SendMerchantMessage(player, "This item can't be sold."); return(false); } return(true); }
public virtual void DisplayMessage(GameClient client, string message, params object[] objs) { if (client == null || !client.IsPlaying) { return; } ChatUtil.SendSystemMessage(client, string.Format(message, objs)); return; }
public void HandlePacket(GameClient client, GSPacketIn packet) { // player is null, return // active consignment merchant is null, return if (!(client.Player?.ActiveInventoryObject is GameConsignmentMerchant conMerchant)) { return; } // current house is null, return House house = HouseMgr.GetHouse(conMerchant.HouseNumber); if (house == null) { return; } // make sure player has permissions to withdraw from the consignment merchant if (!house.CanUseConsignmentMerchant(client.Player, ConsignmentPermissions.Withdraw)) { client.Player.Out.SendMessage("You don't have permission to withdraw money from this merchant!", eChatType.CT_Important, eChatLoc.CL_ChatWindow); return; } lock (conMerchant.LockObject()) { long totalConMoney = conMerchant.TotalMoney; if (totalConMoney > 0) { if (ServerProperties.Properties.CONSIGNMENT_USE_BP) { client.Player.Out.SendMessage($"You withdraw {totalConMoney} BountyPoints from your Merchant.", eChatType.CT_Important, eChatLoc.CL_ChatWindow); client.Player.BountyPoints += totalConMoney; client.Player.Out.SendUpdatePoints(); } else { ChatUtil.SendMerchantMessage(client, "GameMerchant.OnPlayerWithdraw", Money.GetString(totalConMoney)); client.Player.AddMoney(totalConMoney); InventoryLogging.LogInventoryAction(conMerchant, client.Player, eInventoryActionType.Merchant, totalConMoney); } conMerchant.TotalMoney -= totalConMoney; if (ServerProperties.Properties.MARKET_ENABLE_LOG) { Log.Debug($"CM: [{client.Player.Name}:{client.Account.Name}] withdraws {totalConMoney} from CM on lot {conMerchant.HouseNumber}."); } client.Out.SendConsignmentMerchantMoney(conMerchant.TotalMoney); } } }
public override IList GetExamineMessages(GamePlayer player) { /* * You select the Keep Gate. It belongs to your realm. * You target [the Keep Gate] * * You select the Keep Gate. It belongs to an enemy realm and can be attacked! * You target [the Keep Gate] * * You select the Postern Door. It belongs to an enemy realm! * You target [the Postern Door] */ IList list = base.GetExamineMessages(player); string text = "You select the " + Name + "."; if (!GameServer.KeepManager.IsEnemy(this, player)) { text = text + " It belongs to your realm."; } else { if (IsAttackableDoor) { text = text + " It belongs to an enemy realm and can be attacked!"; } else { text = text + " It belongs to an enemy realm!"; } } list.Add(text); ChatUtil.SendDebugMessage(player, "Health = " + Health); if (IsAttackableDoor) { // Attempt to fix issue where some players see door as closed when it should be broken open // if you target a door it will re-broadcast it's state if (Health <= 0 && State != eDoorState.Open) { State = eDoorState.Open; BroadcastDoorStatus(); } else if (State == eDoorState.Open) { player.SendDoorUpdate(this, true); } } return(list); }
public void Execute(IRocketPlayer caller, string[] command) { foreach (var player in Provider.clients.Select(UnturnedPlayer.FromSteamPlayer)) { player.Heal(100, true, true); player.Hunger = 0; player.Thirst = 0; player.Infection = 0; } ChatUtil.Broadcast(Plugin.Instance.Translate("HEAL_ALL")); }
/// <summary> /// Called on every timer tick /// </summary> protected override void OnTick() { var player = (GamePlayer)m_actionSource; if (!player.IsRiding) { ChatUtil.SendSystemMessage(player, "You are not riding any steed!"); return; } player.DismountSteed(false); }
public async Task ProcessAsync(IDialogContext context, LuisResult result) { await context.PostAsync("Atualmente, consigo te falar sobre as academias de Krav-Magá em Belo Horizonte. Espera um pouco enquanto busco as informações...") .ContinueWith(task => ChatUtil.Typing(context)); var gyms = await ApiGym.GetAllGymsAsync(); await context.PostAsync("Veja as academias que encontrei:") .ContinueWith(task => ChatUtil.Typing(context, 700)) .ContinueWith(task => context.PostAsync(GetGymAsMessage(gyms))); context.Done <string>(null); }
public void Execute(IRocketPlayer caller, string[] command) { var airdropNodeIds = LevelNodes.nodes.Where(n => n.type == ENodeType.AIRDROP).Cast <AirdropNode>().Select(n => n.id).ToArray(); foreach (var player in Provider.clients.Select(UnturnedPlayer.FromSteamPlayer)) { int index = random.Next(airdropNodeIds.Length); LevelManager.airdrop(player.Position, airdropNodeIds[index], 128f); } ChatUtil.Broadcast(Plugin.Instance.Translate("AIRDROP_ALL")); }
public async Task ProcessAsync(IDialogContext context, LuisResult result) { var imageImi = context.MakeMessage(); imageImi.Attachments.Add(Images.Imi); await context.PostAsync(imageImi) .ContinueWith(task => context.PostAsync("Imi Lichtenfeld é o seu nome. Ensinou a homens simples como utilizar o próprio corpo, transformando-os em soldados imbatíveis. A eficácia de seus ensinamentos surpreende e sua obra é reconhecida no mundo todo. Sua criação torna-se a filosofia de defesa do Estado de Israel e unidades militares de elite ao redor do mundo utilizam suas técnicas.")) .ContinueWith(task => ChatUtil.Typing(context, 2000)) .ContinueWith(task => context.PostAsync("Algumas frases do Imi:")) .ContinueWith(task => context.PostAsync(PhrasesImi())); context.Done <string>(null); }
private long m_nextCallForHelpTime = 0; // Used to limit how often keep lords call for help /// <summary> /// Bring all alive keep guards to defend the lord /// </summary> /// <param name="trigger">The entity which triggered the BAF.</param> protected override void BringFriends(GameLiving trigger) { if (GameServer.Instance.Configuration.ServerType == eGameServerType.GST_PvE) { GuardLord lord = Body as GuardLord; long currenttime = DateTime.UtcNow.Ticks; if (lord != null && m_nextCallForHelpTime < currenttime) { // Don't call for help more than once every minute m_nextCallForHelpTime = currenttime + TimeSpan.TicksPerMinute; int iGuardsResponding = 0; foreach (GameKeepGuard guard in lord.Component.Keep.Guards.Values) { if (guard != null && guard.IsAlive && guard.IsAvailable) { if (guard.AssistLord(lord)) { iGuardsResponding++; } } } string sMessage = $"{lord.Name} bellows for assistance "; if (iGuardsResponding == 0) { sMessage += "but no guards respond!"; } else { sMessage += $"and {iGuardsResponding} guards respond!"; } foreach (GamePlayer player in lord.GetPlayersInRadius(WorldMgr.VISIBILITY_DISTANCE, true)) { if (player != null) { ChatUtil.SendErrorMessage(player, sMessage); } } } } else { base.BringFriends(trigger); } }
public InteractionData(ChatUtil chatUtil, string interactionID) { try { InitializeComponent(); _interactionID = interactionID; _chatUtil = chatUtil; this.DataContext = _chatUtil; _chatUtil.CaseDataUpdated += new ChatUtil.UpdatedCaseData(_chatUtil_CaseDataUpdated); } catch (Exception generalException) { _logger.Error("Error occurred in InteractionData() : " + generalException.ToString()); } }
/// <summary> /// Called on every timer tick /// </summary> protected override void OnTick() { var player = (GamePlayer)m_actionSource; if (player.TargetObject == null || player.TargetObject == player) { ChatUtil.SendSystemMessage(player, "You have not selected a valid player as your target."); return; } if (!(player.TargetObject is GamePlayer)) { ChatUtil.SendSystemMessage(player, "You have not selected a valid player as your target."); return; } var target = (GamePlayer)player.TargetObject; if (player.Group != null && player.Group.Leader != player) { ChatUtil.SendSystemMessage(player, "You are not the leader of your group."); return; } if (player.Group != null && player.Group.MemberCount >= ServerProperties.Properties.GROUP_MAX_MEMBER) { ChatUtil.SendSystemMessage(player, "The group is full."); return; } if (!GameServer.ServerRules.IsAllowedToGroup(player, target, false)) { return; } if (target.Group != null) { ChatUtil.SendSystemMessage(player, "The player is still in a group."); return; } ChatUtil.SendSystemMessage(player, "You have invited " + target.Name + " to join your group."); target.Out.SendGroupInviteCommand(player, player.Name + " has invited you to join\n" + player.GetPronoun(1, false) + " group. Do you wish to join?"); ChatUtil.SendSystemMessage(target, player.Name + " has invited you to join " + player.GetPronoun(1, false) + " group."); }
public async Task ProcessAsync(IDialogContext context, LuisResult result) { var imageGraduation = context.MakeMessage(); imageGraduation.Attachments.Add(Images.Graduation); await context.PostAsync("A graduação do Krav-Magá é composta das seguintes faixas:") .ContinueWith(task => ChatUtil.Typing(context, 500)) .ContinueWith(task => context.PostAsync("Branca, Amarela, Laranja, Verde, Azul, Marrom e Preta")) .ContinueWith(task => ChatUtil.Typing(context, 1000)) .ContinueWith(task => context.PostAsync("Na faixa preta, existem 5 dans e, após, existe ainda uma sequência da faixa branca e vermelha. Veja a imagem abaixo pra você entender um pouco melhor:")) .ContinueWith(task => ChatUtil.Typing(context, 1000)) .ContinueWith(task => context.PostAsync(imageGraduation)); context.Done <string>(null); }
public async Task LocationReceivedAsync(IDialogContext context, IAwaitable <IMessageActivity> argument) { var msg = await argument; var reply = context.MakeMessage(); var location = msg.Entities?.Where(t => t.Type == "Place").Select(t => t.GetAs <Place>()).FirstOrDefault(); context.Done(location); if (location == null) { reply.Text = "謝謝您的使用!"; await context.PostAsync(reply); return; } var geo = (location.Geo as JObject)?.ToObject <GeoCoordinates>(); reply.Text = "距離您地點最近的輔具中心是..."; if (geo != null) { Dictionary <string, string> site = ChatUtil.GetNearestLocation(Convert.ToDouble(geo.Latitude), Convert.ToDouble(geo.Longitude), Sites); double siteLat = Convert.ToDouble(site["lat"]); double siteLon = Convert.ToDouble(site["lon"]); reply.Attachments.Add(new HeroCard { Title = site["name"], Subtitle = site["address"], Text = Environment.NewLine + site["phone"] + Environment.NewLine + site["email"], Buttons = new List <CardAction> { new CardAction { Title = "帶我去" + site["name"], Type = ActionTypes.OpenUrl, Value = "https://www.google.com.tw//maps/place/" + site["name"] + $"/@{siteLat},{siteLon},15z", //Value = $"https://www.bing.com/maps/?v=2&cp={siteLat}~{siteLon}&lvl=16&dir=0&sty=c&sp=point.{siteLat}_{siteLon}_You%20are%20here&ignoreoptin=1" } } }.ToAttachment()); } else { reply.Text = "這是哪裡阿﹍"; } await context.PostAsync(reply); }
private static void HouseRemovalDialog(GamePlayer player, byte response) { if (response != 0x01) { return; } var itemWeak = player.TempProperties.getProperty <WeakReference>(DeedWeak, new WeakRef(null)); player.TempProperties.removeProperty(DeedWeak); var item = (InventoryItem)itemWeak.Target; var house = player.TempProperties.getProperty <House>(TargetHouse, null); player.TempProperties.removeProperty(TargetHouse); if (house == null) { ChatUtil.SendSystemMessage(player, "No house selected!"); return; } if (item == null || item.SlotPosition == (int)eInventorySlot.Ground || item.OwnerID == null || item.OwnerID != player.InternalID) { ChatUtil.SendSystemMessage(player, "You need a House Removal Deed for this."); return; } // Demand any consignment merchant inventory is removed before allowing a removal // Again, note that sometimes checks are done here, sometimes in housemgr. In this case, at least, // player will get remove item back if they answer no! - tolakram var consignmentMerchant = house.ConsignmentMerchant; if (consignmentMerchant != null && (consignmentMerchant.DBItems(player).Count > 0 || consignmentMerchant.TotalMoney > 0)) { ChatUtil.SendSystemMessage(player, "All items and money must be removed from your consignment merchant in order to remove this house!"); return; } player.Inventory.RemoveItem(item); Log.Warn($"HOUSING: {player.Name}:{player.Client.Account.Name} is removing house from lot {house.HouseNumber} owned by {house.OwnerID}"); InventoryLogging.LogInventoryAction(player, $"(HOUSE;{house.HouseNumber})", eInventoryActionType.Other, item.Template, item.Count); HouseMgr.RemoveHouse(house); ChatUtil.SendSystemMessage(player, "Your house has been removed!"); }