本文整理汇总了C#中wServer.realm.entities.Player类的典型用法代码示例。如果您正苦于以下问题:C# Player类的具体用法?C# Player怎么用?C# Player使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Player类属于wServer.realm.entities命名空间,在下文中一共展示了Player类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: Buy
public virtual void Buy(Player player)
{
if (ObjectType == 0x0505) //Vault chest
{
//if (new Database().ReadVault(player.Client.Account).Chests.Count < 64)
//{
if (TryDeduct(player))
{
var chest = new Database().CreateChest(player.Client.Account);
(Owner as Vault).AddChest(chest, this);
player.Client.SendPacket(new BuyResultPacket()
{
Result = 0,
Message = "Vault Chest Get!"
});
}
else
player.Client.SendPacket(new BuyResultPacket()
{
Result = BUY_NO_FAME,
Message = "Not enough fame!"
});
/*}
else
{
player.Client.SendPacket(new BuyResultPacket()
{
Result = 0,
Message = "You have a full vault!"
});
}*/
}
}
开发者ID:Club559,项目名称:Mining,代码行数:33,代码来源:SellableObject.cs
示例2: Process
protected override bool Process(Player player, RealmTime time, string args)
{
if (player.HasConditionEffect(ConditionEffects.Paused))
{
player.ApplyConditionEffect(new ConditionEffect()
{
Effect = ConditionEffectIndex.Paused,
DurationMS = 0
});
player.SendInfo("Game resumed.");
return true;
}
else
{
if (player.Owner.EnemiesCollision.HitTest(player.X, player.Y, 8).OfType<Enemy>().Any())
{
player.SendError("Not safe to pause.");
return false;
}
else
{
player.ApplyConditionEffect(new ConditionEffect()
{
Effect = ConditionEffectIndex.Paused,
DurationMS = -1
});
player.SendInfo("Game paused.");
return true;
}
}
}
开发者ID:Jankos132,项目名称:Server-Source,代码行数:31,代码来源:WorldCommand.cs
示例3: GetPermissionLevel
static int GetPermissionLevel(Player player)
{
if (player.Client.Account.Admin)
return 1;
else
return 0;
}
开发者ID:Jankos132,项目名称:Server-Source,代码行数:7,代码来源:Command.cs
示例4: AcceptTrade
public void AcceptTrade(Player sender, AcceptTradePacket pkt)
{
if (sender == player1)
{
if (pkt.MyOffers.SequenceEqual(player1Trades) && pkt.YourOffers.SequenceEqual(player2Trades))
{
player2.Client.SendPacket(new TradeAcceptedPacket
{
MyOffers = player2Trades,
YourOffers = player1Trades
});
player1Accept = true;
}
}
else
{
if (pkt.MyOffers.SequenceEqual(player2Trades) && pkt.YourOffers.SequenceEqual(player1Trades))
{
player1.Client.SendPacket(new TradeAcceptedPacket
{
MyOffers = player1Trades,
YourOffers = player2Trades
});
player2Accept = true;
}
}
if (player1Accept && player2Accept)
Trade();
}
开发者ID:Club559,项目名称:Travs-Domain-Server,代码行数:30,代码来源:TradeManager.cs
示例5: Process
protected override bool Process(Player player, RealmTime time, string args)
{
Command[] cmds = player.Manager.Commands.Commands.Values
.Where(x => x.HasPermission(player))
.ToArray();
int curPage = (args != "") ? Convert.ToInt32(args) : 1;
double maxPage = Math.Floor((double) cmds.Length/10);
if (curPage > maxPage + 1)
curPage = (int) maxPage + 1;
if (curPage < 1)
curPage = 1;
var sb = new StringBuilder(string.Format("Commands <Page {0}/{1}>: \n", curPage, maxPage + 1));
int y = (curPage - 1) * 10;
int z = y + 10;
int commands = cmds.Length;
if (z > commands)
{
z = commands;
}
for (int i = y; i < z; i++)
{
sb.Append(string.Format("[/{0}{1}]{2}", cmds[i].CommandName, (cmds[i].CommandUsage != "" ? " " + cmds[i].CommandUsage : null), (cmds[i].CommandDesc != "" ? ": " + cmds[i].CommandDesc : null)) + "\n");
}
player.SendHelp(sb.ToString());
return true;
}
开发者ID:Club559,项目名称:Travs-Domain-Server,代码行数:32,代码来源:WorldCommand.cs
示例6: Process
protected override bool Process(Player player, RealmTime time, string args)
{
ConditionEffectIndex effect;
if (!Enum.TryParse(args, true, out effect))
{
player.SendError("Invalid effect!");
return false;
}
if ((player.ConditionEffects & (ConditionEffects)(1 << (int)effect)) != 0)
{
//remove
player.ApplyConditionEffect(new ConditionEffect()
{
Effect = effect,
DurationMS = 0
});
}
else
{
//add
player.ApplyConditionEffect(new ConditionEffect()
{
Effect = effect,
DurationMS = -1
});
}
return true;
}
开发者ID:Jankos132,项目名称:Server-Source,代码行数:28,代码来源:AdminCommands.cs
示例7: Process
protected override bool Process(Player player, RealmTime time, string args)
{
if (player.Guild != "")
try
{
var saytext = string.Join(" ", args);
if ((from w in player.Manager.Worlds let world = w.Value where w.Key != 0 from i in world.Players.Where(i => i.Value.Guild == player.Guild) select world).Any())
{
if (saytext.Equals(" ") || saytext == "")
{
player.SendHelp("Usage: /guild <text>");
return false;
}
player.Manager.Chat.SayGuild(player, saytext.ToSafeText());
return true;
}
}
catch(Exception e)
{
player.SendError(e.ToString());
player.SendInfo("Cannot guild chat!");
return false;
}
else
player.SendInfo("You need to be in a guild to use guild chat!");
return false;
}
开发者ID:Club559,项目名称:Travs-Domain-Server,代码行数:27,代码来源:GuildCommands.cs
示例8: EditObject
public override void EditObject(Player player, ushort type, int x, int y)
{
var tile = Map[x, y].Clone();
if (type != 0 && tile.ObjType != 0)
return;
if (type != 0 && !Manager.GameData.ObjectDescs[type].Static)
{
if (tile.ObjType != 0)
tile.ObjType = 0;
Entity entity = Entity.Resolve(Manager, type);
entity.Move(x + 0.5f, y + 0.5f);
EnterWorld(entity);
return;
}
else if (type != 0)
{
tile.ObjType = type;
tile.ObjId = GetNextEntityId();
}
else
{
Entity entity = GetObjAt(x, y);
if (entity != null)
LeaveWorld(entity);
else
tile.ObjType = 0;
}
Map[x, y] = tile;
}
开发者ID:Club559,项目名称:Travs-Domain-Server,代码行数:29,代码来源:CustomWorld.cs
示例9: Buy
public override void Buy(Player player)
{
if (ObjectType == 0x01ca) //Merchant
{
if (TryDeduct(player))
{
var Inventory = player.Inventory;
for (int i = 0; i < player.Inventory.Length; i++)
{
XElement ist;
XmlDatas.TypeToElement.TryGetValue((short)trueMType, out ist);
if (player.Inventory[i] == null && (player.SlotTypes[i] == 0 || player.SlotTypes[i] == Convert.ToInt16(ist.Element("SlotType").Value))) // Exploit fix - No more mnovas as weapons!
{
player.Inventory[i] = XmlDatas.ItemDescs[(short)trueMType];
player.UpdateCount++;
break;
}
}
player.Client.SendPacket(new BuyResultPacket()
{
Result = 0,
Message = "Purchase Successful!"
});
var ItemName = XmlDatas.ItemDescs[(short)trueMType].ObjectId;
var dir = @"logs";
if (!System.IO.Directory.Exists(dir))
System.IO.Directory.CreateDirectory(dir);
Console.WriteLine("[{3}]User {0} have bought {1} for {2}", player.nName, ItemName, truePrice, DateTime.Now);
using (System.IO.StreamWriter writer = new System.IO.StreamWriter(@"logs\PurchaseLog.txt", true))
{
writer.WriteLine("[{3}]User {0} have bought {1} for {2}", player.nName, ItemName, truePrice, DateTime.Now);
}
}
else
switch (truePrice.Item2)
{
case CurrencyType.Gold:
player.Client.SendPacket(new BuyResultPacket()
{
Result = BUY_NO_GOLD,
Message = "Not enough gold!"
}); break;
case CurrencyType.Fame:
player.Client.SendPacket(new BuyResultPacket()
{
Result = BUY_NO_FAME,
Message = "Not enough fame!"
}); break;
case CurrencyType.AccId:
player.Client.SendPacket(new BuyResultPacket()
{
Result = BUY_NO_GOLD,
Message = "You are not ID #" + truePrice.Item1.ToString() + "!"
}); break;
}
}
base.Buy(player);
}
开发者ID:xzyio,项目名称:Rotmg-PServer,代码行数:59,代码来源:Merchants.cs
示例10: EnterWorld
public override int EnterWorld(Entity entity)
{
int ret = base.EnterWorld(entity);
if (entity is Player && MainPlayer == null)
if ((entity as Player).Party == null || ((entity as Player).Party.Leader == (entity as Player)))
Cleared = (MainPlayer = (entity as Player)).Floors >= Floor;
return ret;
}
开发者ID:Club559,项目名称:Travs-Domain-Server,代码行数:8,代码来源:Tower.cs
示例11: Instance
public static FollowPlayer Instance(Player player)
{
var key = player;
FollowPlayer ret;
if (!instances.TryGetValue(key, out ret))
ret = instances[key] = new FollowPlayer();
return ret;
}
开发者ID:RiiggedMPGH,项目名称:Owl-Realms-Source,代码行数:9,代码来源:FollowPlayer.cs
示例12: Trap
public Trap(Player player, float radius, int dmg, ConditionEffectIndex eff, float effDuration)
: base(0x0711, LIFETIME * 1000, true, true, false)
{
this.player = player;
this.radius = radius;
this.dmg = dmg;
this.effect = eff;
this.duration = (int)(effDuration * 1000);
}
开发者ID:rotmgkillroyx,项目名称:rotmg_svr_OLD,代码行数:9,代码来源:Trap.cs
示例13: GetPermissionLevel
private static int GetPermissionLevel(Player player)
{
switch (player.Client.Account.Rank)
{
case 9001:
return 0;
default:
return player.Client.Account.Rank;
}
}
开发者ID:Club559,项目名称:Travs-Domain-Server,代码行数:10,代码来源:Command.cs
示例14: FollowPlayer
public FollowPlayer()
{
try
{
this.player = Host.Self.PlayerOwner;
}
catch
{
this.player = null;
}
}
开发者ID:RiiggedMPGH,项目名称:Owl-Realms-Source,代码行数:11,代码来源:FollowPlayer.cs
示例15: Process
protected override bool Process(Player player, RealmTime time, string args)
{
if (args.Length == 0)
{
player.SendHelp("Usage: /announce <saytext>");
return false;
}
foreach (var client in player.Manager.Clients.Values)
client.Player.SendText("@Announcement", args);
return true;
}
开发者ID:sebastianfra12,项目名称:Classic-Realm,代码行数:11,代码来源:AdminCommands.cs
示例16: TickCore
protected override bool TickCore(RealmTime time)
{
this.player = Host.Self.PlayerOwner;
if (this.player.Client.Character.Pet == -1 || this.player.Client.Character.Pet != Host.Self.ObjectType)
{
try
{
Host.Self.Owner.LeaveWorld(Host.Self);
}
catch { }
return false;
}
int count = 0;
foreach (var i in Host.Self.Owner.Players)
{
if (i.Value == this.player)
break;
else
count++;
}
if (count == Host.Self.Owner.Players.Count)
{
try
{
Host.Self.Owner.LeaveWorld(Host.Self);
}
catch { }
return false;
}
float dist = 1;
float ddist = Dist(Host.Self, player);
Random rand = new Random();
if ((Entity)player != null && dist < ddist)
{
var tx = player.X + rand.Next(-2, 2) / 2f;
var ty = player.Y + rand.Next(-2, 2) / 2f;
if (tx != Host.Self.X || ty != Host.Self.Y)
{
var x = Host.Self.X;
var y = Host.Self.Y;
Vector2 vect = new Vector2(tx, ty) - new Vector2(Host.Self.X, Host.Self.Y);
vect.Normalize();
vect *= (10 / 1.5f) * (time.thisTickTimes / 1000f); //maybe we can change this to have the same speed as the player?
ValidateAndMove(Host.Self.X + vect.X, Host.Self.Y + vect.Y);
Host.Self.UpdateCount++;
}
return true;
}
else return false;
}
开发者ID:RiiggedMPGH,项目名称:Owl-Realms-Source,代码行数:52,代码来源:FollowPlayer.cs
示例17: HitBy
public void HitBy(Player player, RealmTime time, Projectile projectile, int dmg)
{
int totalDmg;
if (!hitters.TryGetValue(player, out totalDmg))
totalDmg = 0;
totalDmg += dmg;
hitters[player] = totalDmg;
LastProjectile = projectile;
LastHitter = player;
player.FameCounter.Hit(projectile, enemy);
}
开发者ID:RoxyLalonde,项目名称:Phoenix-Realms,代码行数:13,代码来源:DamageCounter.cs
示例18: TradeManager
public TradeManager(Player player1, Player player2)
{
this.player1Trades = new bool[12];
this.player2Trades = new bool[12];
this.player1 = player1;
this.player2 = player2;
TradingPlayers.Add(player1);
TradingPlayers.Add(player2);
if (CurrentRequests.Contains(new KeyValuePair<Player, Player>(player1, player2)))
CurrentRequests.Remove(new KeyValuePair<Player, Player>(player1, player2));
if (CurrentRequests.Contains(new KeyValuePair<Player, Player>(player2, player1)))
CurrentRequests.Remove(new KeyValuePair<Player, Player>(player2, player1));
}
开发者ID:Club559,项目名称:Travs-Domain-Server,代码行数:13,代码来源:TradeManager.cs
示例19: GetBestDuelArena
public static World GetBestDuelArena(Player player)
{
// Partner's level must be +/- (5 + 10%) of player and partner must have same max
// A 5/8 level 40 could only join a 5/8 player between levels 31 - 49
foreach (var i in QueuedPlayers)
{
if (i.Key.Level >= (player.Level - 5) - Math.Floor(player.Level*.1) &&
i.Key.Level <= (player.Level + 5) + Math.Floor(player.Level*.1) &&
i.Key.GetMaxed().Count == player.GetMaxed().Count)
return i.Value;
}
return player.Manager.AddWorld(new DuelArena());
}
开发者ID:Club559,项目名称:Travs-Domain-Server,代码行数:13,代码来源:DuelArena.cs
示例20: Say
public void Say(Player src, string text)
{
src.Owner.BroadcastPacket(new TextPacket()
{
Name = (src.Client.Account.Admin ? "@" : "") + src.Name,
ObjectId = src.Id,
Stars = src.Stars,
BubbleTime = 5,
Recipient = "",
Text = text,
CleanText = text
}, null);
}
开发者ID:xzyio,项目名称:Rotmg-PServer,代码行数:13,代码来源:ChatManager.cs
注:本文中的wServer.realm.entities.Player类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论