public void OnCommand(GameClient client, string[] args) { const string BROAD_TICK = "Broad_Tick"; if (args.Length < 2) { DisplayMessage(client, LanguageMgr.GetTranslation(client, "Scripts.Players.Broadcast.NoText")); return; } if (client.Player.IsMuted) { client.Player.Out.SendMessage("You have been muted. You cannot broadcast.", eChatType.CT_Staff, eChatLoc.CL_SystemWindow); return; } string message = string.Join(" ", args, 1, args.Length - 1); long BroadTick = client.Player.TempProperties.getProperty<long>(BROAD_TICK); if (BroadTick > 0 && BroadTick - client.Player.CurrentRegion.Time <= 0) { client.Player.TempProperties.removeProperty(BROAD_TICK); } long changeTime = client.Player.CurrentRegion.Time - BroadTick; if (changeTime < 800 && BroadTick > 0) { client.Player.Out.SendMessage("Slow down! Think before you say each word!", eChatType.CT_System, eChatLoc.CL_SystemWindow); client.Player.TempProperties.setProperty(BROAD_TICK, client.Player.CurrentRegion.Time); return; } Broadcast(client.Player, message); client.Player.TempProperties.setProperty(BROAD_TICK, client.Player.CurrentRegion.Time); }
public void OnCommand(GameClient client, string[] args) { int housenumber = 0; if (args.Length > 1) { try { housenumber = int.Parse(args[1]); } catch { DisplaySyntax(client); return; } } else HouseMgr.GetHouseNumberByPlayer(client.Player); if (housenumber == 0) { DisplayMessage(client, "No house found."); return; } House house = HouseMgr.GetHouse(housenumber); ushort direction = client.Player.GetHeading(house); client.Player.Heading = direction; client.Out.SendPlayerJump(true); DisplayMessage(client, "You face house " + housenumber); }
public static void DisplayNews(GameClient client) { // N,chanel(0/1/2),index(0-4),string time,\"news\" for (int type = 0; type <= 2; type++) { int index = 0; string realm = ""; //we can see all captures IList<DBNews> newsList; if (type > 0) newsList = GameServer.Database.SelectObjects<DBNews>("`Type` = @Type AND (`Realm` = @DefaultRealm OR `Realm` = @Realm)", new[] { new QueryParameter("@Type", type), new QueryParameter("@DefaultRealm", 0), new QueryParameter("@Realm", realm) }); else newsList = GameServer.Database.SelectObjects<DBNews>("`Type` = @Type", new QueryParameter("@Type", type)); newsList = newsList.OrderByDescending(it => it.CreationDate).Take(5).ToArray(); int n = newsList.Count; while (n > 0) { n--; DBNews news = newsList[n]; client.Out.SendMessage(string.Format("N,{0},{1},{2},\"{3}\"", news.Type, index++, RetElapsedTime(news.CreationDate), news.Text), eChatType.CT_SocialInterface, eChatLoc.CL_SystemWindow); } } }
public void OnCommand(GameClient client, string[] args) { if (IsSpammingCommand(client.Player, "stats")) return; if (client == null) return; if (args.Length > 1) { string playerName = ""; if (args[1].ToLower() == "player") { if (args.Length > 2) { playerName = args[2]; } else { // try and get player name from target if (client.Player.TargetObject != null && client.Player.TargetObject is GamePlayer) { playerName = client.Player.TargetObject.Name; } } } client.Player.Statistics.DisplayServerStatistics(client, args[1].ToLower(), playerName); } else { DisplayMessage(client, client.Player.Statistics.GetStatisticsMessage()); } }
// Display the informations private void DisplayInformations(GameClient client) { byte webDisplay = client.Player.NotDisplayedInHerald; byte webDisplayFlag; string state = "/webdisplay <position|template|equipment|craft> [on|off]\n"; webDisplayFlag = (byte)GlobalConstants.eWebDisplay.equipment; if ((webDisplay & webDisplayFlag) == webDisplayFlag) state += "Your equipment is not displayed.\n"; else state += "Your equipment is displayed.\n"; webDisplayFlag = (byte)GlobalConstants.eWebDisplay.position; if ((webDisplay & webDisplayFlag) == webDisplayFlag) state += "Your position is not displayed.\n"; else state += "Your position is displayed.\n"; webDisplayFlag = (byte)GlobalConstants.eWebDisplay.template; if ((webDisplay & webDisplayFlag) == webDisplayFlag) state += "Your template is not displayed.\n"; else state += "Your template is displayed.\n"; webDisplayFlag = (byte)GlobalConstants.eWebDisplay.craft; if ((webDisplay & webDisplayFlag) == webDisplayFlag) state += "Your crafting skill is not displayed.\n"; else state += "Your crafting skill is displayed.\n"; DisplayMessage(client, state); }
public void OnCommand(GameClient client, string[] args) { if (client.Account.PrivLevel == 1 && ServerProperties.Properties.ANON_MODIFIER == -1) { DisplayMessage(client, LanguageMgr.GetTranslation(client.Account.Language, "Scripts.Players.Anonymous.Error")); return; } client.Player.IsAnonymous = !client.Player.IsAnonymous; string[] friendList = new string[] { client.Player.Name }; if (client.Player.IsAnonymous) { client.Out.SendMessage(LanguageMgr.GetTranslation(client.Account.Language, "Scripts.Players.Anonymous.On"), eChatType.CT_System, eChatLoc.CL_SystemWindow); foreach (GameClient pclient in WorldMgr.GetAllPlayingClients()) { if (pclient.Player.Friends.Contains(client.Player.Name)) pclient.Out.SendRemoveFriends(friendList); } } else { client.Out.SendMessage(LanguageMgr.GetTranslation(client.Account.Language, "Scripts.Players.Anonymous.Off"), eChatType.CT_System, eChatLoc.CL_SystemWindow); foreach (GameClient pclient in WorldMgr.GetAllPlayingClients()) { if (pclient.Player.Friends.Contains(client.Player.Name)) pclient.Out.SendAddFriends(friendList); } } }
public void OnCommand(GameClient client, string[] args) { if (IsSpammingCommand(client.Player, "settitle")) return; int index = -1; if (args.Length > 1) { try { index = int.Parse(args[1]); } catch { } IPlayerTitle current = client.Player.CurrentTitle; if (current != null && current.IsForced(client.Player)) client.Out.SendMessage("You cannot change the current title.", eChatType.CT_System, eChatLoc.CL_SystemWindow); else { IList titles = client.Player.Titles; if (index < 0 || index >= titles.Count) client.Player.CurrentTitle = PlayerTitleMgr.ClearTitle; else client.Player.CurrentTitle = (IPlayerTitle)titles[index]; } } else { client.Out.SendPlayerTitles(); } }
public void OnCommand(GameClient client, string[] args) { if (args.Length < 2) { DisplaySyntax(client); return; } GameClient clientc = null; if (args[1].StartsWith("#")) { try { int sessionID = Convert.ToInt32(args[1].Substring(1)); clientc = WorldMgr.GetClientFromID(sessionID); } catch { DisplayMessage(client, "Invalid client ID"); } } else { clientc = WorldMgr.GetClientByPlayerName(args[1], false, false); } if (clientc == null) { DisplayMessage(client, LanguageMgr.GetTranslation(client.Account.Language, "GMCommands.Kick.NoPlayerOnLine")); return; } if (client.Account.PrivLevel < clientc.Account.PrivLevel) { DisplayMessage(client, "Your privlevel is not high enough to kick this player."); return; } for (int i = 0; i < 8; i++) { string message; if (client != null && client.Player != null) { message = LanguageMgr.GetTranslation(clientc, "GMCommands.Kick.RemovedFromServerByGM", client.Player.Name); } else { message = LanguageMgr.GetTranslation(clientc, "GMCommands.Kick.RemovedFromServer"); } clientc.Out.SendMessage(message, eChatType.CT_Help, eChatLoc.CL_SystemWindow); clientc.Out.SendMessage(message, eChatType.CT_Help, eChatLoc.CL_ChatWindow); } clientc.Out.SendPlayerQuit(true); clientc.Player.SaveIntoDatabase(); clientc.Player.Quit(true); }
public void OnCommand(GameClient client, string[] args) { if (client.Player.Group == null || client.Player.Group.MemberCount < 2) { client.Out.SendMessage("You are not part of a group.",eChatType.CT_System,eChatLoc.CL_SystemWindow); return; } if(client.Player.Group.Leader != client.Player) { client.Out.SendMessage("You are not the leader of your group.",eChatType.CT_System,eChatLoc.CL_SystemWindow); return; } GamePlayer target; if(args.Length<2) // Setting by target { if(client.Player.TargetObject == null || client.Player.TargetObject == client.Player) { client.Out.SendMessage("You have not selected a valid player as your target.",eChatType.CT_System,eChatLoc.CL_SystemWindow); return; } if(!(client.Player.TargetObject is GamePlayer)) { client.Out.SendMessage("You have not selected a valid player as your target.",eChatType.CT_System,eChatLoc.CL_SystemWindow); return; } target = (GamePlayer)client.Player.TargetObject; if(client.Player.Group != target.Group) { client.Out.SendMessage("You have not selected a valid player as your target.",eChatType.CT_System,eChatLoc.CL_SystemWindow); return; } } else //Setting by name { string targetName = args[1]; GameClient targetClient = WorldMgr.GetClientByPlayerName(targetName, false, true); if (targetClient == null) target = null; else target = targetClient.Player; if(target==null || client.Player.Group != target.Group) { // Invalid target client.Out.SendMessage("No players in group with that name.",eChatType.CT_System,eChatLoc.CL_SystemWindow); return; } if(target==client.Player) { client.Out.SendMessage("You are the group leader already.",eChatType.CT_System,eChatLoc.CL_SystemWindow); return; } } client.Player.Group.MakeLeader(target); client.Player.Group.SendMessageToGroupMembers(target.Name + " is new group leader.", eChatType.CT_System, eChatLoc.CL_SystemWindow); }
public void OnCommand(GameClient client, string[] args) { if (IsSpammingCommand(client.Player, "cancelstyle")) return; client.Player.CancelStyle = !client.Player.CancelStyle; DisplayMessage(client, string.Format(LanguageMgr.GetTranslation(client, "Scripts.Players.Cancelstyle.Set", (client.Player.CancelStyle ? LanguageMgr.GetTranslation(client, "Scripts.Players.Cancelstyle.On") : LanguageMgr.GetTranslation(client, "Scripts.Players.Cancelstyle.Off"))))); }
public bool Init(uint num, bool up, GameClient dealer) { if(num < 0 || num > 51) return false; m_id = num; m_faceup = up; m_dealer = dealer; m_name = GetCardName(num); return true; }
/// <summary> /// Command Handling Refreshs. /// </summary> /// <param name="client"></param> /// <param name="args"></param> public void OnCommand(GameClient client, string[] args) { // Init Refresh Attribute Lookup if (!m_initialized) { m_initialized = true; InitRefreshCmdCache(); } if (args.Length < 2) { DisplaySyntax(client); DisplayAvailableModules(client); } // Join args string arg = string.Join(" ", args.Skip(1)).Trim(); if (string.IsNullOrEmpty(arg)) { DisplaySyntax(client); DisplayAvailableModules(client); return; } // Check if arg is "list" or try our module directory if(arg.ToLower().Equals("list")) { DisplayAvailableModules(client); return; } else { var method = m_refreshCommandCache.FirstOrDefault(k => k.Key.ToLower().Equals(arg.ToLower())); if (method.Value == null) { DisplayMessage(client, "Wrong Module argument given... try /refresh list!"); } else { DisplayMessage(client, string.Format("--- Refreshing Module's static cache for: {0}", method.Key)); try { object value = method.Value.Invoke(null, new object[] { }); if (value != null) DisplayMessage(client, string.Format("--- Module returned value: {0}", value)); } catch(Exception e) { DisplayMessage(client, string.Format("-!- Error while refreshing Module's static cache for: {0} - {1}", method.Key, e)); } DisplayMessage(client, string.Format("-.- Refresh Module's static cache Finished for: {0}", method.Key)); } } }
public void FriendsManager_RemovePlayer_RetrieveEmptyFriendsList() { var client = new GameClient(GameServer.Instance) { Account = new Account() { Characters = new [] { new DOLCharacters() { SerializedFriendsList = "buddy" } } }, Out = new TestPacketLib() }; var gameplayer = new GamePlayer(client, client.Account.Characters[0]); GameServer.Instance.PlayerManager.Friends.AddPlayerFriendsListToCache(gameplayer); GameServer.Instance.PlayerManager.Friends.RemovePlayerFriendsListFromCache(gameplayer); CollectionAssert.IsEmpty(gameplayer.GetFriends()); }
public void HandlePacket(GameClient client, GSPacketIn packet) { if (client.Player == null) return; int code = packet.ReadByte(); if (code != 0) { if (log.IsWarnEnabled) log.WarnFormat("bonuses button: code is other than zero ({0})", code); } new RegionTimerAction<GamePlayer>(client.Player, p => p.Out.SendCustomTextWindow(LanguageMgr.GetTranslation(client.Account.Language, "PlayerBonusesListRequestHandler.HandlePacket.Bonuses") , new List<string>(client.Player.GetBonuses()))).Start(1); }
public void OnCommand(GameClient client, string[] args) { if (args.Length < 3) return; bool up = false; if (args[2][0] == 'u') up = true; else if (args[2][0] == 'd') up = false; else return; GameClient friendClient = WorldMgr.GetClientByPlayerName(args[1], true, true); CardMgr.Deal(client, friendClient, up); }
public void OnCommand(GameClient client, string[] args) { House house = client.Player.CurrentHouse; if (!client.Player.InHouse || house == null) { DisplayMessage(client, "You need to be in a House to use this command!"); return; } if (!house.HasOwnerPermissions(client.Player)) { DisplayMessage(client, "You do not have permissions to do that!"); return; } client.Player.Out.SendToggleHousePoints(house); }
public void OnCommand(GameClient client, string[] args) { if (args.Length != 2) { DisplaySyntax(client); } else if (args[1].ToLower().Equals("on")) { if (client.Player.IsStealthed != true) { client.Player.Stealth(true); } } else if (args[1].ToLower().Equals("off")) { client.Player.Stealth(false); } }
/// <summary> /// Change Player Anonymous Flag on Command /// </summary> /// <param name="client"></param> /// <param name="args"></param> public void OnCommand(GameClient client, string[] args) { if (client.Player == null) return; if (client.Account.PrivLevel == 1 && ServerProperties.Properties.ANON_MODIFIER == -1) { DisplayMessage(client, LanguageMgr.GetTranslation(client.Account.Language, "Scripts.Players.Anonymous.Error")); return; } client.Player.IsAnonymous = !client.Player.IsAnonymous; if (client.Player.IsAnonymous) client.Out.SendMessage(LanguageMgr.GetTranslation(client.Account.Language, "Scripts.Players.Anonymous.On"), eChatType.CT_System, eChatLoc.CL_SystemWindow); else client.Out.SendMessage(LanguageMgr.GetTranslation(client.Account.Language, "Scripts.Players.Anonymous.Off"), eChatType.CT_System, eChatLoc.CL_SystemWindow); }
public void OnCommand(GameClient client, string[] args) { if (IsSpammingCommand(client.Player, "statsanon")) return; if (client == null) return; string msg; client.Player.StatsAnonFlag = !client.Player.StatsAnonFlag; if (client.Player.StatsAnonFlag) msg = "Your stats are no longer visible to other players."; else msg = "Your stats are now visible to other players."; client.Player.Out.SendMessage(msg, eChatType.CT_System, eChatLoc.CL_ChatWindow); }
public void HandlePacket(GameClient client, GSPacketIn packet) { if (client.Player == null) return; int code = packet.ReadByte(); if (code != 0) { if (log.IsWarnEnabled) log.Warn("bonuses button: code is other than zero (" + code + ")"); } var info = new List<string>(); client.Player.GetBonuses(info); client.Out.SendCustomTextWindow(LanguageMgr.GetTranslation(client.Account.Language, "PlayerBonusesListRequestHandler.HandlePacket.Bonuses"), info); }
public void OnCommand(GameClient client, string[] args) { if (args.Length < 2) { client.Out.SendMessage("Use: /team <message>", eChatType.CT_System, eChatLoc.CL_SystemWindow); return; } string msg = string.Join(" ", args, 1, args.Length - 1); foreach (GameClient player in WorldMgr.GetAllPlayingClients()) { if (player.Account.PrivLevel > 1) { player.Out.SendMessage("[StaffInformation-" + client.Player.Name + "]:\n " + msg, eChatType.CT_Staff, eChatLoc.CL_ChatWindow); } } }
public void OnCommand(GameClient client, string[] args) { if (args.Length == 1) { DisplayInformations(client); return; } if (args[1].ToLower() == "position") WdChange(GlobalConstants.eWebDisplay.position, client.Player, args.Length==3?args[2].ToLower():null); if (args[1].ToLower() == "equipment") WdChange(GlobalConstants.eWebDisplay.equipment, client.Player, args.Length==3?args[2].ToLower():null); if (args[1].ToLower() == "template") WdChange(GlobalConstants.eWebDisplay.template, client.Player, args.Length==3?args[2].ToLower():null); if (args[1].ToLower() == "craft") WdChange(GlobalConstants.eWebDisplay.craft, client.Player, args.Length==3?args[2].ToLower():null); DisplayInformations(client); }
public bool Init(GameClient Dealer, uint numDecks) { int i,j,tmp,swap; uint [] cards; Card c; if(numDecks < 1) return false; /* Initialize Member Variables */ m_dealer = Dealer; m_numCards = numDecks * 52; /* Initialize the array of 'Cards' and the card queue */ try{ cards = new uint[52*numDecks]; m_Cards = new Queue((int)(52*numDecks));} catch(Exception) { return false; } /* Initialize card IDs for numDecks */ for(i=0; i<numDecks; i++) for(j=0; j<52; j++) cards[i*52+j] = (uint)j; /* Decks have been initialized, shuffle them */ j = (int)m_numCards; for(i=0; i<m_numCards; i++) { swap = Util.Random(j - 1); tmp = (int)cards[i]; cards[i] = cards[swap]; cards[swap] = (uint)tmp; } /* Place the cards in Queue */ for(i=0; i<m_numCards; i++) { c = new Card(); c.Init(cards[i], false, m_dealer); m_Cards.Enqueue(c); } /* OK */ return true; }
public void OnCommand(GameClient client, string[] args) { if (args.Length < 2) { DisplaySyntax(client); return; } if (client != null && client.Player != null) { try { delay = Convert.ToInt32(args[1]); new RegionTimer(client.Player, FreezeCallback).Start(1); } catch { } } }
public void OnCommand(GameClient client, string[] args) { if (client.Player.IsPvP == false) return; if(args.Length >= 2 && args[1].ToLower() == "off") { client.Player.SafetyFlag = false; DisplayMessage(client, "Your safety flag is now set to OFF! You can now attack non allied players, as well as be attacked."); } else if(client.Player.SafetyFlag) { DisplayMessage(client, "The safety flag keeps your character from participating in combat"); DisplayMessage(client, "with non allied players in designated zones when you are below level 10."); DisplayMessage(client, "Type /safety off to begin participating in PvP combat in these zones, though once it is off it can NOT be turned back on!"); } else { DisplayMessage(client, "Your safety flag is already off."); } }
public void OnCommand(GameClient client, string[] args) { if (args.Length < 2 || client == null || client.Player == null) { DisplaySyntax(client); return; } long start,spent; switch(args[1]) { case "listskills": start = GameTimer.GetTickCount(); Enumerable.Range(0, 1000).AsParallel().ForEach(i => { var tmp = client.Player.GetAllUsableSkills(true); } ); spent = GameTimer.GetTickCount() - start; client.Player.Out.SendMessage(string.Format("Skills Benchmark took {0}ms for 1000 iterations...", spent), eChatType.CT_System, eChatLoc.CL_SystemWindow); break; case "listspells": start = GameTimer.GetTickCount(); Enumerable.Range(0, 1000).AsParallel().ForEach(i => { var tmp = client.Player.GetAllUsableListSpells(true); } ); spent = GameTimer.GetTickCount() - start; client.Player.Out.SendMessage(string.Format("Spells Benchmark took {0}ms for 1000 iterations...", spent), eChatType.CT_System, eChatLoc.CL_SystemWindow); break; } }
public void OnCommand(GameClient client, string[] args) { if (args.Length != 3 || (args[1] != "magic" && args[1] != "strength")) { DisplaySyntax(client); return; } DBRelic relic = new DBRelic(); relic.Heading = client.Player.Heading; relic.OriginalRealm = int.Parse(args[2]); relic.Realm = 0; relic.Region = client.Player.CurrentRegionID; relic.relicType = (args[1] == "strength") ? 0 : 1; relic.X = client.Player.X; relic.Y = client.Player.Y; relic.Z = client.Player.Z; relic.RelicID = Util.Random(100); GameServer.Database.AddObject(relic); RelicMgr.Init(); }
public void OnCommand(GameClient client, string[] args) { if (args.Length != 4 || (args[1] != "magic" && args[1] != "strength")) { DisplaySyntax(client); return; } ushort emblem = ushort.Parse(args[3]); emblem += (ushort)((args[1] == "magic") ? 10 : 0); GameRelicPad pad = new GameRelicPad(); pad.Name = args[2]; pad.Realm = (eRealm)byte.Parse(args[3]); pad.Emblem = emblem; pad.CurrentRegionID = client.Player.CurrentRegionID; pad.X = client.Player.X; pad.Y = client.Player.Y; pad.Z = client.Player.Z; pad.Heading = client.Player.Heading; pad.AddToWorld(); pad.SaveIntoDatabase(); }
public void HandlePacket(GameClient client, GSPacketIn packet) { if (client.Player == null) return; uint X = packet.ReadInt(); uint Y = packet.ReadInt(); ushort id =(ushort) packet.ReadShort(); ushort obj=(ushort) packet.ReadShort(); GameObject target = client.Player.TargetObject; if (target == null) { client.Out.SendMessage(LanguageMgr.GetTranslation(client.Account.Language, "PlayerPickUpRequestHandler.HandlePacket.Target"), eChatType.CT_System, eChatLoc.CL_SystemWindow); return; } if (target.ObjectState != GameObject.eObjectState.Active) { client.Out.SendMessage(LanguageMgr.GetTranslation(client.Account.Language, "PlayerPickUpRequestHandler.HandlePacket.InvalidTarget"), eChatType.CT_System, eChatLoc.CL_SystemWindow); return; } client.Player.PickupObject(target, false); }
public static void DisplayNews(GameClient client) { // N,chanel(0/1/2),index(0-4),string time,\"news\" for (int type = 0; type <= 2; type++) { int index = 0; string realm = ""; //we can see all captures if (type > 0) realm = " AND (Realm = 0 OR Realm = " + ((int)client.Player.Realm).ToString() + " ) "; var newsList = GameServer.Database.SelectObjects<DBNews>("`Type` = '" + type + "'" + realm + " ORDER BY `CreationDate` DESC LIMIT 5"); int n = newsList.Count; while (n > 0) { n--; DBNews news = newsList[n]; client.Out.SendMessage(string.Format("N,{0},{1},{2},\"{3}\"", news.Type, index++, RetElapsedTime(news.CreationDate), news.Text), eChatType.CT_SocialInterface, eChatLoc.CL_SystemWindow); } } }
public PlayerHand(GameClient Player) { m_owner = Player; m_hand = new ArrayList(); }
/* True if Player already has a hand in progress */ public static bool IsPlayer(GameClient player) { return(m_playerHands.ContainsKey(player.Player.ObjectId)); }
/* True if Player is the dealer for his group */ public static bool IsDealer(GameClient player) { return(m_dealerDecks.ContainsKey(player.Player.ObjectId)); }