本文整理汇总了C#中ClientInfo.SendPackage方法的典型用法代码示例。如果您正苦于以下问题:C# ClientInfo.SendPackage方法的具体用法?C# ClientInfo.SendPackage怎么用?C# ClientInfo.SendPackage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ClientInfo
的用法示例。
在下文中一共展示了ClientInfo.SendPackage方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TeleHome
public static void TeleHome(ClientInfo _cInfo)
{
Player p = PersistentContainer.Instance.Players[_cInfo.playerId, false];
if (p == null || p.HomePosition == null)
{
string _phrase11;
if (!Phrases.Dict.TryGetValue(11, out _phrase11))
{
_phrase11 = "{PlayerName} you do not have a home saved.";
}
_phrase11 = _phrase11.Replace("{PlayerName}", _cInfo.playerName);
_cInfo.SendPackage(new NetPackageGameMessage(EnumGameMessages.Chat, string.Format("{1}{0}[-]", _phrase11, CustomCommands.ChatColor), "Server", false, "", false));
}
else
{
if (DelayBetweenUses < 1)
{
Home(_cInfo, p.HomePosition);
}
else
{
if (p.LastSetHome == null)
{
Home(_cInfo, p.HomePosition);
}
else
{
TimeSpan varTime = DateTime.Now - p.LastSetHome;
double fractionalMinutes = varTime.TotalMinutes;
int _timepassed = (int)fractionalMinutes;
if (_timepassed > DelayBetweenUses)
{
Home(_cInfo, p.HomePosition);
}
else
{
int _timeleft = DelayBetweenUses - _timepassed;
string _phrase13;
if (!Phrases.Dict.TryGetValue(13, out _phrase13))
{
_phrase13 = "{PlayerName} you can only use /home once every {DelayBetweenUses} minutes. Time remaining: {TimeRemaining} minutes.";
}
_phrase13 = _phrase13.Replace("{PlayerName}", _cInfo.playerName);
_phrase13 = _phrase13.Replace("{DelayBetweenUses}", DelayBetweenUses.ToString());
_phrase13 = _phrase13.Replace("{TimeRemaining}", _timeleft.ToString());
_cInfo.SendPackage(new NetPackageGameMessage(EnumGameMessages.Chat, string.Format("{1}{0}[-]", _phrase13, CustomCommands.ChatColor), "Server", false, "", false));
}
}
}
}
}
示例2: Reply
public static void Reply(ClientInfo _cInfo, string _message)
{
if (_message.StartsWith("R "))
{
_message = _message.Replace("R ", "");
}
if (_message.StartsWith("r "))
{
_message = _message.Replace("r ", "");
}
if (_message.StartsWith("re "))
{
_message = _message.Replace("re ", "");
}
if (_message.StartsWith("RE "))
{
_message = _message.Replace("RE ", "");
}
if (PersistentContainer.Instance.Players[_cInfo.playerId, true].LastWhisper == null)
{
string _phrase15;
if (!Phrases.Dict.TryGetValue(15, out _phrase15))
{
_phrase15 = "{SenderName} no one has pm'd you.";
}
_phrase15 = _phrase15.Replace("{SenderName}", _cInfo.playerName);
_cInfo.SendPackage(new NetPackageGameMessage(EnumGameMessages.Chat, string.Format("{1}{0}[-]", _phrase15, CustomCommands.ChatColor), "Server", false, "", false));
}
else
{
ClientInfo _cInfo1 = ConnectionManager.Instance.GetClientInfoForPlayerId(PersistentContainer.Instance.Players[_cInfo.playerId, true].LastWhisper);
if (_cInfo1 == null)
{
string _phrase16;
if (!Phrases.Dict.TryGetValue(16, out _phrase16))
{
_phrase16 = "{SenderName} the player is not online.";
}
_phrase16 = _phrase16.Replace("{SenderName}", _cInfo.playerName);
_cInfo.SendPackage(new NetPackageGameMessage(EnumGameMessages.Chat, string.Format("{1}{0}[-]", _phrase16, CustomCommands.ChatColor), "Server", false, "", false));
}
else
{
_cInfo1.SendPackage(new NetPackageGameMessage(EnumGameMessages.Chat, string.Format("(PM) {0}", _message), _cInfo.playerName, false, "", false));
PersistentContainer.Instance.Players[_cInfo1.playerId, true].LastWhisper = _cInfo.playerId;
PersistentContainer.Instance.Save();
}
}
}
示例3: SendAdmins
public static void SendAdmins(ClientInfo _sender, string _message)
{
if (!GameManager.Instance.adminTools.IsAdmin(_sender.playerId))
{
string _phrase200;
if (!Phrases.Dict.TryGetValue(200, out _phrase200))
{
_phrase200 = "{PlayerName} you do not have permissions to use this command.";
}
_phrase200 = _phrase200.Replace("{PlayerName}", _sender.playerName);
_sender.SendPackage(new NetPackageGameMessage(EnumGameMessages.Chat, string.Format("{0}{1}[-]", CustomCommands.ChatColor, _phrase200), "Server", false, "", false));
}
else
{
List<ClientInfo> _cInfoList = ConnectionManager.Instance.GetClients();
foreach (ClientInfo _cInfo in _cInfoList)
{
if (GameManager.Instance.adminTools.IsAdmin(_cInfo.playerId))
{
_message = _message.Replace("@ADMINS ", "");
_message = _message.Replace("@admins ", "");
_cInfo.SendPackage(new NetPackageGameMessage(EnumGameMessages.Chat, string.Format("[FF0080]{0}[-]", _message), _sender.playerName, false, "", false));
}
}
}
}
示例4: SendMessage
public static void SendMessage(ClientInfo _receiver, string senderName, string teamName, string _message)
{
if (senderName != null && teamName != null && _message != null) {
_receiver.SendPackage (new NetPackageGameMessage (_message, "[00ffff]" + senderName + " (" + teamName + ")[-]"));
string receiverName = _receiver.playerName;
string[] strArrays = new string[] { "Message to player ", null, null, null, null };
strArrays[1] = (receiverName == null ? "unknownName" : string.Concat("\"", receiverName, "\""));
strArrays[2] = " sent with sender \"";
strArrays[3] = senderName;
strArrays[4] = "\"";
SdtdConsole.Instance.Output(string.Concat(strArrays));
}
}
示例5: CheckPlayer
public static void CheckPlayer(ClientInfo _cInfo, bool _announce)
{
if (DelayBetweenUses < 1)
{
KillPlayer(_cInfo);
}
else
{
Player p = PersistentContainer.Instance.Players[_cInfo.playerId, false];
if (p == null || p.LastKillme == null)
{
KillPlayer(_cInfo);
}
else
{
TimeSpan varTime = DateTime.Now - p.LastKillme;
double fractionalMinutes = varTime.TotalMinutes;
int _timepassed = (int)fractionalMinutes;
if (_timepassed > DelayBetweenUses)
{
KillPlayer(_cInfo);
}
else
{
int _timeremaining = DelayBetweenUses - _timepassed;
string _phrase8;
if (!Phrases.Dict.TryGetValue(8, out _phrase8))
{
_phrase8 = "{PlayerName} you can only use /killme once every {DelayBetweenUses} minutes. Time remaining: {TimeRemaining} minutes.";
}
_phrase8 = _phrase8.Replace("{PlayerName}", _cInfo.playerName);
_phrase8 = _phrase8.Replace("{DelayBetweenUses}", DelayBetweenUses.ToString());
_phrase8 = _phrase8.Replace("{TimeRemaining}", _timeremaining.ToString());
if (_announce)
{
GameManager.Instance.GameMessageServer(_cInfo, EnumGameMessages.Chat, string.Format("{0}{1}[-]", CustomCommands.ChatColor, _phrase8), "Server", false, "", false);
}
else
{
_cInfo.SendPackage(new NetPackageGameMessage(EnumGameMessages.Chat, string.Format("{0}{1}[-]", CustomCommands.ChatColor, _phrase8), "Server", false, "", false));
}
}
}
}
}
示例6: SendMessage
public static void SendMessage(ClientInfo _receiver, ClientInfo _sender, string _message)
{
string senderName;
if (_sender != null) {
PrivateMassageConnections.SetLastPMSender (_sender, _receiver);
senderName = _sender.playerName;
} else {
senderName = "Server";
}
_receiver.SendPackage (new NetPackageGameMessage (_message, senderName + " (PM)"));
string receiverName = _receiver.playerName;
string[] strArrays = new string[] { "Message to player ", null, null, null, null };
strArrays[1] = (receiverName == null ? "unknownName" : string.Concat("\"", receiverName, "\""));
strArrays[2] = " sent with sender \"";
strArrays[3] = senderName;
strArrays[4] = "\"";
SdtdConsole.Instance.Output(string.Concat(strArrays));
}
示例7: SetHome
public static void SetHome(ClientInfo _cInfo)
{
EntityPlayer _player = GameManager.Instance.World.Players.dict[_cInfo.entityId];
Vector3 _position = _player.GetPosition();
string x = _position.x.ToString();
string y = _position.y.ToString();
string z = _position.z.ToString();
string _sposition = x + "," + y + "," + z;
PersistentContainer.Instance.Players[_cInfo.playerId, true].HomePosition = _sposition;
PersistentContainer.Instance.Save();
string _phrase10;
if (!Phrases.Dict.TryGetValue(10, out _phrase10))
{
_phrase10 = "{PlayerName} your home has been saved.";
}
_phrase10 = _phrase10.Replace("{PlayerName}", _cInfo.playerName);
_cInfo.SendPackage(new NetPackageGameMessage(EnumGameMessages.Chat, string.Format("{1}{0}[-]", _phrase10, CustomCommands.ChatColor), "Server", false, "", false));
}
示例8: SendAll
public static void SendAll(ClientInfo _cInfo, string _message)
{
string[] _commands = { "say" };
if (!GameManager.Instance.adminTools.CommandAllowedFor(_commands, _cInfo.playerId))
{
string _phrase200;
if (!Phrases.Dict.TryGetValue(200, out _phrase200))
{
_phrase200 = "{PlayerName} you do not have permissions to use this command.";
}
_phrase200 = _phrase200.Replace("{PlayerName}", _cInfo.playerName);
_cInfo.SendPackage(new NetPackageGameMessage(EnumGameMessages.Chat, string.Format("{0}{1}[-]", CustomCommands.ChatColor, _phrase200), "Server", false, "", false));
}
else
{
_message = _message.Replace("@ALL ", "");
_message = _message.Replace("@all ", "");
SdtdConsole.Instance.ExecuteSync(string.Format("say \"[FF8000]{0}[-]\"", _message), _cInfo);
}
}
示例9: Send
public static void Send(ClientInfo _cInfo, string _message)
{
if (_message.StartsWith("w "))
{
_message = _message.Replace("w ", "");
}
if (_message.StartsWith("W "))
{
_message = _message.Replace("W ", "");
}
if(_message.StartsWith("pm "))
{
_message = _message.Replace("pm ", "");
}
if(_message.StartsWith("PM "))
{
_message = _message.Replace("PM ", "");
}
string[] _strings = _message.Split(new char[] { ' ' }, 2);
_strings[1] = _strings[1].TrimStart();
ClientInfo _targetInfo = ConsoleHelper.ParseParamIdOrName(_strings[0]);
if (_targetInfo == null)
{
string _phrase14;
if (!Phrases.Dict.TryGetValue(14, out _phrase14))
{
_phrase14 = "{SenderName} player {TargetName} was not found.";
}
_phrase14 = _phrase14.Replace("{SenderName}", _cInfo.playerName);
_phrase14 = _phrase14.Replace("{TargetName}", _strings[0]);
_cInfo.SendPackage(new NetPackageGameMessage(EnumGameMessages.Chat, string.Format("{1}{0}[-]", _phrase14, CustomCommands.ChatColor), "Server", false, "", false));
}
else
{
_targetInfo.SendPackage(new NetPackageGameMessage(EnumGameMessages.Chat, string.Format("(PM) {0}", _strings[1]), _cInfo.playerName, false, "", false));
PersistentContainer.Instance.Players[_targetInfo.playerId, true].LastWhisper = _cInfo.playerId;
PersistentContainer.Instance.Save();
}
}
示例10: InviteAccept
public static void InviteAccept(ClientInfo _cInfo)
{
Player p = PersistentContainer.Instance.Players[_cInfo.playerId, true];
if (p.InvitedToClan == null)
{
string _phrase113;
if (!Phrases.Dict.TryGetValue(113, out _phrase113))
{
_phrase113 = "{PlayerName} you have not been invited to any clans.";
}
_phrase113 = _phrase113.Replace("{PlayerName}", _cInfo.playerName);
_cInfo.SendPackage(new NetPackageGameMessage(EnumGameMessages.Chat, string.Format("{1}{0}[-]", _phrase113, CustomCommands.ChatColor), "Server", false, "", false));
}
else
{
PersistentContainer.Instance.Players[_cInfo.playerId, false].ClanName = p.InvitedToClan;
PersistentContainer.Instance.Players[_cInfo.playerId, false].InvitedToClan = null;
PersistentContainer.Instance.Save();
List<ClientInfo> _cInfoList = ConnectionManager.Instance.GetClients();
foreach (ClientInfo _cInfo1 in _cInfoList)
{
Player p1 = PersistentContainer.Instance.Players[_cInfo1.playerId, true];
if (p1.ClanName == p.ClanName)
{
string _phrase115;
if (!Phrases.Dict.TryGetValue(115, out _phrase115))
{
_phrase115 = "{PlayerName} has joined the clan.";
}
_phrase115 = _phrase115.Replace("{PlayerName}", _cInfo.playerName);
_cInfo1.SendPackage(new NetPackageGameMessage(EnumGameMessages.Chat, string.Format("{1}{0}[-]", _phrase115, CustomCommands.ChatColor), "Server", false, "", false));
}
}
}
}
示例11: GetInfo
//.........这里部分代码省略.........
else if (_name == "minibike")
{
_miniBikes = _miniBikes + 1;
continue;
}
else if (_name == "sc_General")
{
_supplyCrates = _supplyCrates + 1;
continue;
}
else
{
Log.Out(string.Format("[SERVERTOOLS] Entity Class Name is: {0}", _name));
}
}
string _phrase300;
string _phrase301;
string _phrase302;
string _phrase303;
string _phrase304;
string _phrase305;
string _phrase306;
if (!Phrases.Dict.TryGetValue(300, out _phrase300))
{
_phrase300 = "Server FPS: {Fps}";
}
if (!Phrases.Dict.TryGetValue(301, out _phrase301))
{
_phrase301 = "Next 7th day is in {DaysUntil7} days";
}
if (!Phrases.Dict.TryGetValue(302, out _phrase302))
{
_phrase302 = "Total Players:{Players} Total Zombies:{Zombies} Total Animals:{Animals}";
}
if (!Phrases.Dict.TryGetValue(303, out _phrase303))
{
_phrase303 = "Feral Zombies:{Ferals} Cops:{Cops} Dogs:{Dogs} Bees:{Bees} Screamers:{Screamers}";
}
if (!Phrases.Dict.TryGetValue(304, out _phrase304))
{
_phrase304 = "Bears:{Bears} Stags:{Stags} Pigs:{Pigs} Rabbits:{Rabbits} Chickens:{Chickens}";
}
if (!Phrases.Dict.TryGetValue(305, out _phrase305))
{
_phrase305 = "Total Supply Crates:{SupplyCrates} Total Mini Bikes:{MiniBikes}";
}
if (!Phrases.Dict.TryGetValue(306, out _phrase306))
{
_phrase306 = "Next 7th day is today";
}
_phrase300 = _phrase300.Replace("{Fps}", _fps);
_phrase301 = _phrase301.Replace("{DaysUntil7}", _daysUntil7.ToString());
_phrase302 = _phrase302.Replace("{Players}", _playerCount.ToString());
_phrase302 = _phrase302.Replace("{Zombies}", _zombies.ToString());
_phrase302 = _phrase302.Replace("{Animals}", _animals.ToString());
_phrase303 = _phrase303.Replace("{Ferals}", _feralZombies.ToString());
_phrase303 = _phrase303.Replace("{Cops}", _cop.ToString());
_phrase303 = _phrase303.Replace("{Dogs}", _dog.ToString());
_phrase303 = _phrase303.Replace("{Bees}", _hornet.ToString());
_phrase303 = _phrase303.Replace("{Screamers}", _screamer.ToString());
_phrase304 = _phrase304.Replace("{Bears}", _bear.ToString());
_phrase304 = _phrase304.Replace("{Stags}", _stag.ToString());
_phrase304 = _phrase304.Replace("{Pigs}", _pig.ToString());
_phrase304 = _phrase304.Replace("{Rabbits}", _rabbit.ToString());
_phrase304 = _phrase304.Replace("{Chickens}", _chicken.ToString());
_phrase305 = _phrase305.Replace("{SupplyCrates}", _supplyCrates.ToString());
_phrase305 = _phrase305.Replace("{MiniBikes}", _miniBikes.ToString());
if (_announce)
{
GameManager.Instance.GameMessageServer(_cInfo, EnumGameMessages.Chat, string.Format("{1}{0}[-]", _phrase300, CustomCommands.ChatColor), "Server", false, "", false);
if (_daysUntil7 == 7)
{
GameManager.Instance.GameMessageServer(_cInfo, EnumGameMessages.Chat, string.Format("{1}{0}[-]", _phrase306, CustomCommands.ChatColor), "Server", false, "", false);
}
else
{
GameManager.Instance.GameMessageServer(_cInfo, EnumGameMessages.Chat, string.Format("{1}{0}[-]", _phrase301, CustomCommands.ChatColor), "Server", false, "", false);
}
GameManager.Instance.GameMessageServer(_cInfo, EnumGameMessages.Chat, string.Format("{1}{0}[-]", _phrase302, CustomCommands.ChatColor), "Server", false, "", false);
GameManager.Instance.GameMessageServer(_cInfo, EnumGameMessages.Chat, string.Format("{1}{0}[-]", _phrase303, CustomCommands.ChatColor), "Server", false, "", false);
GameManager.Instance.GameMessageServer(_cInfo, EnumGameMessages.Chat, string.Format("{1}{0}[-]", _phrase304, CustomCommands.ChatColor), "Server", false, "", false);
GameManager.Instance.GameMessageServer(_cInfo, EnumGameMessages.Chat, string.Format("{1}{0}[-]", _phrase305, CustomCommands.ChatColor), "Server", false, "", false);
}
else
{
_cInfo.SendPackage(new NetPackageGameMessage(EnumGameMessages.Chat, string.Format("{1}{0}[-]", _phrase300, CustomCommands.ChatColor), "Server", false, "", false));
if (_daysUntil7 == 7)
{
_cInfo.SendPackage(new NetPackageGameMessage(EnumGameMessages.Chat, string.Format("{1}{0}[-]", _phrase306, CustomCommands.ChatColor), "Server", false, "", false));
}
else
{
_cInfo.SendPackage(new NetPackageGameMessage(EnumGameMessages.Chat, string.Format("{1}{0}[-]", _phrase301, CustomCommands.ChatColor), "Server", false, "", false));
}
_cInfo.SendPackage(new NetPackageGameMessage(EnumGameMessages.Chat, string.Format("{1}{0}[-]", _phrase302, CustomCommands.ChatColor), "Server", false, "", false));
_cInfo.SendPackage(new NetPackageGameMessage(EnumGameMessages.Chat, string.Format("{1}{0}[-]", _phrase303, CustomCommands.ChatColor), "Server", false, "", false));
_cInfo.SendPackage(new NetPackageGameMessage(EnumGameMessages.Chat, string.Format("{1}{0}[-]", _phrase304, CustomCommands.ChatColor), "Server", false, "", false));
_cInfo.SendPackage(new NetPackageGameMessage(EnumGameMessages.Chat, string.Format("{1}{0}[-]", _phrase305, CustomCommands.ChatColor), "Server", false, "", false));
}
}
示例12: InviteDecline
public static void InviteDecline(ClientInfo _cInfo)
{
Player p = PersistentContainer.Instance.Players[_cInfo.playerId, true];
if (p.InvitedToClan == null)
{
string _phrase113;
if (!Phrases.Dict.TryGetValue(113, out _phrase113))
{
_phrase113 = "{PlayerName} you have not been invited to any clans.";
}
_phrase113 = _phrase113.Replace("{PlayerName}", _cInfo.playerName);
_cInfo.SendPackage(new NetPackageGameMessage(EnumGameMessages.Chat, string.Format("{1}{0}[-]", _phrase113, CustomCommands.ChatColor), "Server", false, "", false));
}
else
{
PersistentContainer.Instance.Players[_cInfo.playerId, false].InvitedToClan = null;
PersistentContainer.Instance.Save();
string _phrase116;
if (!Phrases.Dict.TryGetValue(116, out _phrase116))
{
_phrase116 = "{PlayerName} you have declined the invite to the clan.";
}
_phrase116 = _phrase116.Replace("{PlayerName}", _cInfo.playerName);
_cInfo.SendPackage(new NetPackageGameMessage(EnumGameMessages.Chat, string.Format("{1}{0}[-]", _phrase116, CustomCommands.ChatColor), "Server", false, "", false));
}
}
示例13: CheckInv
public static void CheckInv(ClientInfo _cInfo, PlayerDataFile _playerDataFile)
{
if (_cInfo != null && !GameManager.Instance.adminTools.IsAdmin(_cInfo.playerId))
{
for (int i = 0; i < _playerDataFile.inventory.Length; i++)
{
ItemStack _intemStack = new ItemStack();
ItemValue _itemValue = new ItemValue();
_intemStack = _playerDataFile.inventory[i];
_itemValue = _intemStack.itemValue;
int _count = _playerDataFile.inventory[i].count;
if (_count > 0 && _itemValue != null && !_itemValue.Equals(ItemValue.None) && _cInfo != null)
{
int _maxAllowed = ItemClass.list[_itemValue.type].Stacknumber.Value;
string _name = ItemClass.list[_itemValue.type].GetItemName();
if (AnounceInvalidStack && _count > _maxAllowed)
{
string _phrase3;
if (!Phrases.Dict.TryGetValue(3, out _phrase3))
{
_phrase3 = "{PlayerName} you have a invalid item stack: {ItemName} {ItemCount}. Max per stack: {MaxPerStack}.";
}
_phrase3 = _phrase3.Replace("{PlayerName}", _cInfo.playerName);
_phrase3 = _phrase3.Replace("{ItemName}", _name);
_phrase3 = _phrase3.Replace("{ItemCount}", _count.ToString());
_phrase3 = _phrase3.Replace("{MaxPerStack}", _maxAllowed.ToString());
_cInfo.SendPackage(new NetPackageGameMessage(EnumGameMessages.Chat, string.Format("[FF8000]{0}[-]", _phrase3), "Server", false, "", false));
ChatLog.Log(_phrase3, "Server");
}
if (IsEnabled && dict.ContainsKey(_name))
{
if (BanPlayer)
{
string _phrase4;
if (!Phrases.Dict.TryGetValue(4, out _phrase4))
{
_phrase4 = "Cheat Detected: Auto banned {PlayerName} for having a invalid item: {ItemName}.";
}
_phrase4 = _phrase4.Replace("{PlayerName}", _cInfo.playerName);
_phrase4 = _phrase4.Replace("{ItemName}", _name);
GameManager.Instance.GameMessageServer(_cInfo, EnumGameMessages.Chat, string.Format("[FF8000]{0}[-]", _phrase4), "Server", false, "", false);
SdtdConsole.Instance.ExecuteSync(string.Format("ban add {0} 10 years \"Invalid Item {1}\"", _cInfo.entityId, _name), _cInfo);
}
else
{
string _phrase5;
if (!Phrases.Dict.TryGetValue(5, out _phrase5))
{
_phrase5 = "Cheat Detected: Auto kicked {PlayerName} for having a invalid item: {ItemName}.";
}
_phrase5 = _phrase5.Replace("{PlayerName}", _cInfo.playerName);
_phrase5 = _phrase5.Replace("{ItemName}", _name);
GameManager.Instance.GameMessageServer(_cInfo, EnumGameMessages.Chat, string.Format("[FF8000]{0}[-]", _phrase5), "Server", false, "", false);
SdtdConsole.Instance.ExecuteSync(string.Format("kick {0} \"Invalid Item: {1}\"", _cInfo.entityId, _name), _cInfo);
}
break;
}
}
}
for (int i = 0; i < _playerDataFile.bag.Length; i++)
{
ItemStack _intemStack = new ItemStack();
ItemValue _itemValue = new ItemValue();
_intemStack = _playerDataFile.bag[i];
_itemValue = _intemStack.itemValue;
int _count = _playerDataFile.bag[i].count;
if (_count > 0 && _itemValue != null && !_itemValue.Equals(ItemValue.None) && _cInfo != null)
{
int _maxAllowed = ItemClass.list[_itemValue.type].Stacknumber.Value;
string _name = ItemClass.list[_itemValue.type].GetItemName();
if (AnounceInvalidStack && _count > _maxAllowed)
{
string _phrase3;
if (!Phrases.Dict.TryGetValue(3, out _phrase3))
{
_phrase3 = "{PlayerName} you have a invalid item stack: {ItemName} {ItemCount}. Max per stack: {MaxPerStack}.";
}
_phrase3 = _phrase3.Replace("{PlayerName}", _cInfo.playerName);
_phrase3 = _phrase3.Replace("{ItemName}", _name);
_phrase3 = _phrase3.Replace("{ItemCount}", _count.ToString());
_phrase3 = _phrase3.Replace("{MaxPerStack}", _maxAllowed.ToString());
_cInfo.SendPackage(new NetPackageGameMessage(EnumGameMessages.Chat, string.Format("[FF8000]{0}[-]", _phrase3), "Server", false, "", false));
ChatLog.Log(_phrase3, "Server");
}
if (IsEnabled && dict.ContainsKey(_name))
{
if (BanPlayer)
{
string _phrase4;
if (!Phrases.Dict.TryGetValue(4, out _phrase4))
{
_phrase4 = "Cheat Detected: Auto banned {PlayerName} for having a invalid item: {ItemName}.";
}
_phrase4 = _phrase4.Replace("{PlayerName}", _cInfo.playerName);
_phrase4 = _phrase4.Replace("{ItemName}", _name);
GameManager.Instance.GameMessageServer(_cInfo, EnumGameMessages.Chat, string.Format("[FF8000]{0}[-]", _phrase4), "Server", false, "", false);
SdtdConsole.Instance.ExecuteSync(string.Format("ban add {0} 10 years \"Invalid Item {1}\"", _cInfo.entityId, _name), _cInfo);
}
else
{
//.........这里部分代码省略.........
示例14: PromoteMember
public static void PromoteMember(ClientInfo _cInfo, string _playerName)
{
Player p = PersistentContainer.Instance.Players[_cInfo.playerId, true];
if (!p.IsClanOwner)
{
string _phrase107;
if (!Phrases.Dict.TryGetValue(107, out _phrase107))
{
_phrase107 = "{PlayerName} you do not have permissions to use this command.";
}
_phrase107 = _phrase107.Replace("{PlayerName}", _cInfo.playerName);
_cInfo.SendPackage(new NetPackageGameMessage(EnumGameMessages.Chat, string.Format("{1}{0}[-]", _phrase107, CustomCommands.ChatColor), "Server", false, "", false));
}
else
{
ClientInfo _playertoPromote = ConsoleHelper.ParseParamIdOrName(_playerName);
if (_playertoPromote == null)
{
string _phrase108;
if (!Phrases.Dict.TryGetValue(108, out _phrase108))
{
_phrase108 = "{PlayerName} the name {TargetPlayerName} was not found.";
}
_phrase108 = _phrase108.Replace("{PlayerName}", _cInfo.playerName);
_phrase108 = _phrase108.Replace("{TargetPlayerName}", _playerName);
_cInfo.SendPackage(new NetPackageGameMessage(EnumGameMessages.Chat, string.Format("{1}{0}[-]", _phrase108, CustomCommands.ChatColor), "Server", false, "", false));
}
else
{
Player p1 = PersistentContainer.Instance.Players[_playertoPromote.playerId, true];
if (p.ClanName != p1.ClanName)
{
string _phrase117;
if (!Phrases.Dict.TryGetValue(117, out _phrase117))
{
_phrase117 = "{PlayerName} is not a member of your clan.";
}
_phrase117 = _phrase117.Replace("{PlayerName}", _playerName);
_cInfo.SendPackage(new NetPackageGameMessage(EnumGameMessages.Chat, string.Format("{1}{0}[-]", _phrase117, CustomCommands.ChatColor), "Server", false, "", false));
}
else
{
if (p1.IsClanOfficer)
{
string _phrase122;
if (!Phrases.Dict.TryGetValue(122, out _phrase122))
{
_phrase122 = "{PlayerName} is already a officer.";
}
_phrase122 = _phrase122.Replace("{PlayerName}", _playerName);
_cInfo.SendPackage(new NetPackageGameMessage(EnumGameMessages.Chat, string.Format("{1}{0}[-]", _phrase122, CustomCommands.ChatColor), "Server", false, "", false));
}
else
{
PersistentContainer.Instance.Players[_playertoPromote.playerId, false].IsClanOfficer = true;
PersistentContainer.Instance.Save();
string _phrase123;
if (!Phrases.Dict.TryGetValue(123, out _phrase123))
{
_phrase123 = "{PlayerName} has been promoted to an officer.";
}
_phrase123 = _phrase123.Replace("{PlayerName}", _playerName);
_cInfo.SendPackage(new NetPackageGameMessage(EnumGameMessages.Chat, string.Format("{1}{0}[-]", _phrase123, CustomCommands.ChatColor), "Server", false, "", false));
}
}
}
}
}
示例15: _GiveItem
private static void _GiveItem(ClientInfo _cInfo, bool _announce)
{
_randomItem = GimmeItems.RandomObject();
if (_gameItems.ContainsKey(_randomItem))
{
_itemValue = _gameItems[_randomItem].Clone();
}
else
{
_randomItem = _randomItem.ToLower();
foreach (KeyValuePair<string, ItemValue> _key in _gameItems)
{
if (_key.Key.ToLower().Equals(_randomItem))
{
_itemValue = _key.Value.Clone();
}
}
}
EntityPlayer _player = GameManager.Instance.World.Players.dict[_cInfo.entityId];
if (_itemValue.HasQuality)
{
_itemValue.Quality = _player.GetLevel() * 10;
}
if( _gimmeItems.TryGetValue(_randomItem, out _itemcounts))
{
_minmax = _itemcounts.Split(',');
if (int.TryParse(_minmax[0], out _min) && int.TryParse(_minmax[1], out _max))
{
int _count = _random.Next(_min, _max);
ItemStack _itemDrop = new ItemStack(_itemValue, _count);
GameManager.Instance.ItemDropServer(_itemDrop, _player.GetPosition(), Vector3.zero, -1, 60);
if (_announce)
{
GameManager.Instance.GameMessageServer(_cInfo, "[00FF00]" + _cInfo.playerName + " has received " + _count.ToString() + " " + _randomItem + ".[-]", "Server");
}
else
{
_cInfo.SendPackage(new NetPackageGameMessage("[00FF00]You have received " + _count.ToString() + " " + _randomItem + ".[-]", "Server"));
}
_gimmePlayers.Add(_cInfo.playerId, DateTime.Now);
UpdatePlayerXml();
}
}
}