本文整理汇总了C#中Server.MirObjects.PlayerObject.Enqueue方法的典型用法代码示例。如果您正苦于以下问题:C# PlayerObject.Enqueue方法的具体用法?C# PlayerObject.Enqueue怎么用?C# PlayerObject.Enqueue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Server.MirObjects.PlayerObject
的用法示例。
在下文中一共展示了PlayerObject.Enqueue方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TradeReply
public void TradeReply(bool accept)
{
if (TradeInvitation == null || TradeInvitation.Info == null)
{
TradeInvitation = null;
return;
}
if (!accept)
{
TradeInvitation.ReceiveChat(string.Format("Player {0} has refused to trade.", Info.Name), ChatType.System);
TradeInvitation = null;
return;
}
if (TradePartner != null)
{
ReceiveChat("You are already trading.", ChatType.System);
TradeInvitation = null;
return;
}
if (TradeInvitation.TradePartner != null)
{
ReceiveChat(string.Format("Player {0} is already trading.", TradeInvitation.Info.Name), ChatType.System);
TradeInvitation = null;
return;
}
TradePartner = TradeInvitation;
TradeInvitation.TradePartner = this;
TradeInvitation = null;
Enqueue(new S.TradeAccept { Name = TradePartner.Info.Name });
TradePartner.Enqueue(new S.TradeAccept { Name = Info.Name });
}
示例2: SendHealth
public override void SendHealth(PlayerObject player)
{
if (!player.IsMember(Master) && !(player.IsMember(EXPOwner) && AutoRev) && Envir.Time > RevTime) return;
byte time = Math.Min(byte.MaxValue, (byte) Math.Max(5, (RevTime - Envir.Time)/1000));
player.Enqueue(new S.ObjectHealth { ObjectID = ObjectID, Percent = PercentHealth, Expire = time });
}
示例3: Failed
private void Failed(PlayerObject player)
{
Act(ElseActList, player);
var parseElseSay = new List<String>(ElseSay);
parseElseSay = ParseSay(player, parseElseSay);
player.Enqueue(new S.NPCResponse { Page = parseElseSay });
}
示例4: SendGuildStatus
public void SendGuildStatus(PlayerObject member)
{
member.Enqueue(new ServerPackets.GuildStatus()
{
GuildName = Name,
GuildRankName = member.MyGuildRank != null? member.MyGuildRank.Name: "",
Experience = Experience,
MaxExperience = MaxExperience,
MemberCount = Membercount,
MaxMembers = MemberCap,
Gold = Gold,
Level = Level,
Voting = Voting,
SparePoints = SparePoints,
ItemCount = (byte)StoredItems.Length,
BuffCount = (byte)0,//(byte)BuffList.Count,
MyOptions = member.MyGuildRank != null? member.MyGuildRank.Options: (RankOptions)0,
MyRankId = member.MyGuildRank != null? member.MyGuildRank.Index: 256
});
}
示例5: Remove
public virtual void Remove(PlayerObject player)
{
player.Enqueue(new S.ObjectRemove {ObjectID = ObjectID});
}
示例6: Response
private void Response(PlayerObject player, NPCPage page)
{
player.Enqueue(new S.NPCResponse { Page = player.NPCSpeech });
ProcessSpecial(player, page);
}
示例7: Call
public void Call(PlayerObject player, string key)
{
key = key.ToUpper();
if (!player.NPCDelayed)
{
if (key != MainKey) // && ObjectID != player.DefaultNPC.ObjectID
{
if (player.NPCID != ObjectID) return;
bool found = false;
if (player.NPCSuccess)
{
foreach (NPCSegment segment in player.NPCPage.SegmentList)
{
if (segment.Buttons.Any(c => c.ToUpper().Contains(key))) found = true;
}
}
else
{
foreach (NPCSegment segment in player.NPCPage.SegmentList)
{
if (!segment.ElseButtons.Any(c => c.ToUpper().Contains(key))) found = true;
}
}
if (!found) return;
}
}
else
{
player.NPCDelayed = false;
}
if (key.StartsWith("[@@") && player.NPCInputStr == string.Empty)
{
//send off packet to request input
player.Enqueue(new S.NPCRequestInput { NPCID = ObjectID, PageName = key });
return;
}
for (int i = 0; i < NPCPages.Count; i++)
{
NPCPage page = NPCPages[i];
if (!String.Equals(page.Key, key, StringComparison.CurrentCultureIgnoreCase)) continue;
player.NPCSpeech = new List<string>();
foreach (NPCSegment segment in page.SegmentList)
{
ProcessSegment(player, page, segment);
}
Response(player, page);
}
player.NPCInputStr = string.Empty;
}
示例8: Failed
private void Failed(PlayerObject player)
{
Act(ElseActList, player);
player.Enqueue(new S.NPCResponse {Page = ElseSay});
}
示例9: Success
private void Success(PlayerObject player)
{
Act(ActList, player);
player.Enqueue(new S.NPCResponse {Page = Say});
}
示例10: ProcessPage
private void ProcessPage(PlayerObject player, NPCPage page)
{
player.NPCID = ObjectID;
player.NPCPage = page;
player.NPCSuccess = page.Check(player);
switch (page.Key)
{
case BuyKey:
for (int i = 0; i < Goods.Count; i++)
player.CheckItemInfo(Goods[i]);
player.Enqueue(new S.NPCGoods {List = GoodsIndex, Rate = Info.PriceRate});
break;
case SellKey:
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 StorageKey:
player.SendStorage();
player.Enqueue(new S.NPCStorage());
break;
case BuyBackKey:
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;
}
}
示例11: Act
private void Act(List<NPCActions> acts, PlayerObject player)
{
for (int i = 0; i < acts.Count; i++)
{
NPCActions act = acts[i];
uint gold;
uint count;
switch (act.Type)
{
case ActionType.Teleport:
Map temp = SMain.Envir.GetMap((int) act.Params[0]);
if (temp == null) return;
player.Teleport(temp, (Point) act.Params[1]);
break;
case ActionType.GiveGold:
gold = (uint)act.Params[0];
if (gold + player.Account.Gold >= uint.MaxValue)
gold = uint.MaxValue - player.Account.Gold;
player.GainGold(gold);
break;
case ActionType.TakeGold:
gold = (uint) act.Params[0];
if (gold >= player.Account.Gold) gold = player.Account.Gold;
player.Account.Gold -= gold;
player.Enqueue(new S.LoseGold { Gold = gold });
break;
case ActionType.GiveItem:
count = (uint)act.Params[1];
while (count > 0)
{
UserItem item = SMain.Envir.CreateFreshItem((ItemInfo)act.Params[0]);
if (item == null)
{
SMain.Enqueue(string.Format("Failed to create UserItem: {0}, Page: {1}", act.Params[0], Key));
return;
}
if (item.Info.StackSize > count)
{
item.Count = count;
count = 0;
}
else
{
count -= item.Info.StackSize;
item.Count = item.Info.StackSize;
}
if (player.CanGainItem(item, false))
player.GainItem(item);
}
break;
case ActionType.TakeItem:
ItemInfo info = (ItemInfo) act.Params[0];
count = (uint) act.Params[1];
for (int o = 0; o < player.Info.Inventory.Length; o++)
{
UserItem item = player.Info.Inventory[o];
if (item.Info != info) continue;
if (count > item.Count)
{
player.Enqueue(new S.DeleteItem {UniqueID = item.UniqueID, Count = item.Count});
player.Info.Inventory[o] = null;
count -= item.Count;
continue;
}
player.Enqueue(new S.DeleteItem { UniqueID = item.UniqueID, Count = count });
if (count == item.Count)
player.Info.Inventory[o] = null;
else
item.Count -= count;
break;
}
player.RefreshStats();
break;
}
}
}
示例12: Buy
public void Buy(PlayerObject player, int index, uint count)
{
ItemInfo info = null;
for (int i = 0; i < Goods.Count; i++)
{
if (Goods[i].Index != index) continue;
info = Goods[i];
break;
}
if (count == 0 || info == null || count > info.StackSize) return;
uint cost = info.Price*count;
cost = (uint) (cost*Info.PriceRate);
if (cost > player.Account.Gold) return;
UserItem item = Envir.CreateFreshItem(info);
item.Count = count;
if (!player.CanGainItem(item)) return;
player.Account.Gold -= cost;
player.Enqueue(new S.LoseGold {Gold = cost});
player.GainItem(item);
}
示例13: NewMember
public void NewMember(PlayerObject newmember)
{
if (Ranks.Count < 2)
Ranks.Add(new Rank() { Name = "Members", Index = 1});
Rank currentrank = Ranks[Ranks.Count - 1];
GuildMember Member = new GuildMember() { name = newmember.Info.Name, Player = newmember, Id = newmember.Info.Index, LastLogin = Envir.Now, Online = true };
currentrank.Members.Add(Member);
PlayerLogged(newmember, true, true);
newmember.RefreshStats();
newmember.Enqueue(new ServerPackets.GuildBuffList() { ActiveBuffs = BuffList });
Membercount++;
NeedSave = true;
}
示例14: Success
private void Success(PlayerObject player)
{
Act(ActList, player);
var parseSay = new List<String>(Say);
parseSay = ParseSay(player, parseSay);
player.Enqueue(new S.NPCResponse { Page = parseSay });
}
示例15: Add
public virtual void Add(PlayerObject player)
{
player.Enqueue(GetInfo());
}