本文整理汇总了C#中Server.MirObjects.PlayerObject.ReceiveChat方法的典型用法代码示例。如果您正苦于以下问题:C# PlayerObject.ReceiveChat方法的具体用法?C# PlayerObject.ReceiveChat怎么用?C# PlayerObject.ReceiveChat使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Server.MirObjects.PlayerObject
的用法示例。
在下文中一共展示了PlayerObject.ReceiveChat方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: NewRank
public bool NewRank(PlayerObject Self)
{
if (Ranks.Count >= byte.MaxValue)
{
Self.ReceiveChat("You cannot have anymore ranks.", ChatType.System);
return false;
}
int NewIndex = Ranks.Count > 1? Ranks.Count -1: 1;
Rank NewRank = new Rank(){Index = NewIndex, Name = String.Format("Rank-{0}",NewIndex), Options = (RankOptions)0};
Ranks.Insert(NewIndex, NewRank);
Ranks[Ranks.Count - 1].Index = Ranks.Count - 1;
List<Rank> NewRankList = new List<Rank>();
NewRankList.Add(NewRank);
SendServerPacket(new ServerPackets.GuildMemberChange() { Name = Self.Name, Status = (byte)6, Ranks = NewRankList});
NeedSave = true;
return true;
}
示例2: DeleteMember
public bool DeleteMember(PlayerObject Kicker, string membername)
{
//carefull this can lead to guild with no ranks or members(or no leader)
GuildMember Member = null;
Rank MemberRank = null;
if ((Kicker.MyGuild != this) || (Kicker.MyGuildRank == null)) return false;
for (int i = 0; i < Ranks.Count; i++)
for (int j = 0; j < Ranks[i].Members.Count; j++)
if (Ranks[i].Members[j].name == membername)
{
Member = Ranks[i].Members[j];
MemberRank = Ranks[i];
goto Found;
}
Found:
if (Member == null) return false;
if (((Kicker.MyGuildRank.Index >= MemberRank.Index) && (Kicker.MyGuildRank.Index != 0)) && (Kicker.Info.Name != membername))
{
Kicker.ReceiveChat("Your rank is not adequate.", ChatType.System);
return false;
}
if (MemberRank.Index == 0)
{
if (MemberRank.Members.Count < 2)
{
Kicker.ReceiveChat("You cannot leave the guild when you're leader.", ChatType.System);
return false;
}
for (int i = 0; i < MemberRank.Members.Count; i++)
if ((MemberRank.Members[i].Online) && (MemberRank.Members[i] != Member))
goto AllOk;
Kicker.ReceiveChat("You need at least 1 leader online.", ChatType.System);
return false;
}
AllOk:
MemberDeleted(membername, (PlayerObject)Member.Player, Member.name == Kicker.Info.Name);
MemberRank.Members.Remove(Member);
NeedSave = true;
Membercount--;
return true;
}
示例3: MemberDeleted
public void MemberDeleted(string name, PlayerObject formermember, bool kickself)
{
PlayerObject player = null;
for (int i = 0; i < Ranks.Count; i++)
for (int j = 0; j < Ranks[i].Members.Count; j++)
{
if ((Ranks[i].Members[j].Player != null) && (Ranks[i].Members[j].Player != formermember))
{
player = (PlayerObject)Ranks[i].Members[j].Player;
player.Enqueue(new ServerPackets.GuildMemberChange() { Name = name, Status = (byte)(kickself ? 4:3) });
player.GuildMembersChanged = true;
}
}
if (formermember != null)
{
formermember.Info.GuildIndex = -1;
formermember.MyGuild = null;
formermember.MyGuildRank = null;
formermember.ReceiveChat(kickself ? "You have left your guild." : "You have been removed from your guild.", ChatType.Guild);
formermember.Enqueue(new ServerPackets.GuildStatus() { GuildName = "", GuildRankName = "", MyOptions = (RankOptions)0 });
formermember.BroadcastInfo();
}
}
示例4: ChangeRankOption
public bool ChangeRankOption(PlayerObject Self, byte RankIndex, int Option, string Enabled)
{
if ((RankIndex >= Ranks.Count) || (Option > 7))
{
Self.ReceiveChat("Rank not found!", ChatType.System);
return false;
}
if (Self.MyGuildRank.Index >= RankIndex)
{
Self.ReceiveChat("You cannot change the options of your own rank!", ChatType.System);
return false;
}
if ((Enabled != "true") && (Enabled != "false"))
{
return false;
}
Ranks[RankIndex].Options = Enabled == "true" ? Ranks[RankIndex].Options |= (RankOptions)(1 << Option) : Ranks[RankIndex].Options ^= (RankOptions)(1 << Option);
List<Rank> NewRankList = new List<Rank>();
NewRankList.Add(Ranks[RankIndex]);
SendServerPacket(new ServerPackets.GuildMemberChange() { Name = Self.Name, Status = (byte)7, Ranks = NewRankList });
NeedSave = true;
return true;
}
示例5: ChangeRankName
public bool ChangeRankName(PlayerObject Self, string RankName, byte RankIndex)
{
int SelfRankIndex = -1;
for (int i = 0; i < Ranks.Count; i++)
for (int j = 0; j < Ranks[i].Members.Count; j++)
{
if (Ranks[i].Members[j].Player == Self)
{
SelfRankIndex = i;
break;
}
}
if (SelfRankIndex > RankIndex)
{
Self.ReceiveChat("Your rank is not adequate.", ChatType.System);
return false;
}
if (RankIndex >= Ranks.Count)
return false;
Ranks[RankIndex].Name = RankName;
PlayerObject player = null;
List<Rank> NewRankList = new List<Rank>();
NewRankList.Add(Ranks[RankIndex]);
for (int i = 0; i < Ranks.Count; i++)
for (int j = 0; j < Ranks[i].Members.Count; j++)
{
player = (PlayerObject)Ranks[i].Members[j].Player;
if (player != null)
{
player.Enqueue(new ServerPackets.GuildMemberChange() { Name = Self.Info.Name, Status = (byte)7, Ranks = NewRankList });
player.GuildMembersChanged = true;
if (i == RankIndex)
player.BroadcastInfo();
}
}
NeedSave = true;
return true;
}
示例6: ChangeRank
public bool ChangeRank(PlayerObject Self, string membername, byte RankIndex, string RankName = "Members")
{
if ((Self.MyGuild != this) || (Self.MyGuildRank == null)) return false;
if (RankIndex >= Ranks.Count) return false;
GuildMember Member = null;
Rank MemberRank = null;
for (int i = 0; i < Ranks.Count; i++)
for (int j = 0; j < Ranks[i].Members.Count; j++)
if (Ranks[i].Members[j].name == membername)
{
Member = Ranks[i].Members[j];
MemberRank = Ranks[i];
goto Found;
}
Found:
if (Member == null) return false;
MirDatabase.CharacterInfo Character = Envir.GetCharacterInfo(membername);
if (Character == null) return false;
if ((RankIndex == 0) && (Character.Level < Settings.Guild_RequiredLevel))
{
Self.ReceiveChat(String.Format("A guild leader needs to be at least level {0}", Settings.Guild_RequiredLevel), ChatType.System);
return false;
}
if ((MemberRank.Index >= Self.MyGuildRank.Index) && (Self.MyGuildRank.Index != 0))return false;
if (MemberRank.Index == 0)
{
if (MemberRank.Members.Count <= 2)
{
Self.ReceiveChat("A guild needs at least 2 leaders.", ChatType.System);
return false;
}
for (int i = 0; i < MemberRank.Members.Count; i++)
{
if ((MemberRank.Members[i].Player != null) && (MemberRank.Members[i] != Member))
goto AllOk;
}
Self.ReceiveChat("You need at least 1 leader online.", ChatType.System);
return false;
}
AllOk:
Ranks[RankIndex].Members.Add(Member);
MemberRank.Members.Remove(Member);
MemberRank = Ranks[RankIndex];
List<Rank> NewRankList = new List<Rank>();
NewRankList.Add(Ranks[RankIndex]);
NeedSave = true;
PlayerObject player = (PlayerObject)Member.Player;
if (player != null)
{
player.MyGuildRank = Ranks[RankIndex];
player.Enqueue(new ServerPackets.GuildMemberChange() { Name = Self.Info.Name, Status = (byte)8, Ranks = NewRankList });
player.BroadcastInfo();
}
for (int i = 0; i < Ranks.Count; i++)
for (int j = 0; j < Ranks[i].Members.Count; j++)
if ((Ranks[i].Members[j].Player != null) && (Ranks[i].Members[j].Player != Member.Player))
{
player = (PlayerObject)Ranks[i].Members[j].Player;
player.Enqueue(new ServerPackets.GuildMemberChange() { Name = Member.name, Status = (byte)5, RankIndex = (byte)MemberRank.Index });
player.GuildMembersChanged = true;
}
return true;
}
示例7: ProcessSpecial
private void ProcessSpecial(PlayerObject player, NPCPage page)
{
List<UserItem> allGoods = new List<UserItem>();
switch (page.Key.ToUpper())
{
case BuyKey:
for (int i = 0; i < Goods.Count; i++)
player.CheckItem(Goods[i]);
player.Enqueue(new S.NPCGoods { List = Goods, Rate = Info.PriceRate });
break;
case SellKey:
player.Enqueue(new S.NPCSell());
break;
case BuySellKey:
for (int i = 0; i < Goods.Count; i++)
player.CheckItem(Goods[i]);
player.Enqueue(new S.NPCGoods { List = Goods, Rate = Info.PriceRate });
player.Enqueue(new S.NPCSell());
break;
case RepairKey:
player.Enqueue(new S.NPCRepair { Rate = Info.PriceRate });
break;
case SRepairKey:
player.Enqueue(new S.NPCSRepair { Rate = Info.PriceRate });
break;
case RefineKey:
if (player.Info.CurrentRefine != null)
{
player.ReceiveChat("You're already refining an item.", ChatType.System);
player.Enqueue(new S.NPCRefine { Rate = (Settings.RefineCost), Refining = true });
break;
}
else
player.Enqueue(new S.NPCRefine { Rate = (Settings.RefineCost), Refining = false });
break;
case RefineCheckKey:
player.Enqueue(new S.NPCCheckRefine());
break;
case RefineCollectKey:
player.CollectRefine();
break;
case ReplaceWedRingKey:
player.Enqueue(new S.NPCReplaceWedRing { Rate = Settings.ReplaceWedRingCost });
break;
case StorageKey:
player.SendStorage();
player.Enqueue(new S.NPCStorage());
break;
case BuyBackKey:
if (!BuyBack.ContainsKey(player.Name)) BuyBack[player.Name] = new List<UserItem>();
for (int i = 0; i < BuyBack[player.Name].Count; i++)
{
player.CheckItem(BuyBack[player.Name][i]);
}
player.Enqueue(new S.NPCGoods { List = BuyBack[player.Name], Rate = Info.PriceRate });
break;
case BuyUsedKey:
for (int i = 0; i < UsedGoods.Count; i++)
player.CheckItem(UsedGoods[i]);
player.Enqueue(new S.NPCGoods { List = UsedGoods, Rate = Info.PriceRate });
break;
case ConsignKey:
player.Enqueue(new S.NPCConsign());
break;
case MarketKey:
player.UserMatch = false;
player.GetMarket(string.Empty, ItemType.Nothing);
break;
case ConsignmentsKey:
player.UserMatch = true;
player.GetMarket(string.Empty, ItemType.Nothing);
break;
case GuildCreateKey:
if (player.Info.Level < Settings.Guild_RequiredLevel)
{
player.ReceiveChat(String.Format("You have to be at least level {0} to create a guild.", Settings.Guild_RequiredLevel), ChatType.System);
}
if (player.MyGuild == null)
{
player.CanCreateGuild = true;
player.Enqueue(new S.GuildNameRequest());
}
else
player.ReceiveChat("You are already part of a guild.", ChatType.System);
break;
case RequestWarKey:
if (player.MyGuild != null)
{
if (player.MyGuildRank != player.MyGuild.Ranks[0])
{
player.ReceiveChat("You must be the leader to request a war.", ChatType.System);
return;
}
player.Enqueue(new S.GuildRequestWar());
//.........这里部分代码省略.........
示例8: Act
//.........这里部分代码省略.........
monster.Master = player;
monster.MaxPetLevel = 7;
monster.Direction = player.Direction;
monster.ActionTime = SMain.Envir.Time + 1000;
monster.Spawn(player.CurrentMap, player.CurrentLocation);
player.Pets.Add(monster);
}
break;
case ActionType.AddNameList:
path = (string)act.Params[0];
if (File.ReadAllLines(path).All(t => player.Name != t))
{
using (var line = File.AppendText(path))
{
line.WriteLine(player.Name);
}
}
break;
case ActionType.DelNameList:
path = (string)act.Params[0];
File.WriteAllLines(path, File.ReadLines(path).Where(l => l != player.Name).ToList());
break;
case ActionType.ClearNameList:
path = (string)act.Params[0];
File.WriteAllLines(path, new string[] { });
break;
case ActionType.GiveHP:
player.ChangeHP((int)act.Params[0]);
break;
case ActionType.GiveMP:
player.ChangeMP((int)act.Params[0]);
break;
case ActionType.ChangeLevel:
player.Level = (byte) act.Params[0];
player.LevelUp();
break;
case ActionType.SetPkPoint:
player.PKPoints = (int) act.Params[0];
break;
case ActionType.ChangeGender:
switch (player.Info.Gender)
{
case MirGender.Male:
player.Info.Gender = MirGender.Female;
break;
case MirGender.Female:
player.Info.Gender = MirGender.Male;
break;
}
break;
case ActionType.ChangeClass:
var data = (MirClass)act.Params[0];
switch (data)
{
case MirClass.Warrior:
player.Info.Class = MirClass.Warrior;
break;
case MirClass.Taoist:
player.Info.Class = MirClass.Taoist;
break;
case MirClass.Wizard:
player.Info.Class = MirClass.Wizard;
break;
case MirClass.Assassin:
player.Info.Class = MirClass.Assassin;
break;
}
break;
case ActionType.LineMessage:
player.ReceiveChat((string)act.Params[0], (ChatType)act.Params[1]);
break;
case ActionType.GiveSkill:
var magic = new UserMagic((Spell)act.Params[0]) { Level = (byte)act.Params[1] };
player.Info.Magics.Add(magic);
player.Enqueue(magic.GetInfo());
break;
case ActionType.Goto:
player.NPCGoto = true;
player.NPCGotoPage = "[" + act.Params[0] + "]";
break;
case ActionType.Set:
player.Info.Flags[(uint) act.Params[0]] = (bool) act.Params[1];
break;
}
}
}