本文整理汇总了C#中Data.Structures.Player.Player类的典型用法代码示例。如果您正苦于以下问题:C# Player类的具体用法?C# Player怎么用?C# Player使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Player类属于Data.Structures.Player命名空间,在下文中一共展示了Player类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Start
public void Start(Player player)
{
if(!CanPlayerUseGather())
return;
StartGathering();
}
示例2: SaveSkills
public void SaveSkills(Player player)
{
foreach (var skill in player.Skills)
{
SaveSkill(player, skill);
}
}
示例3: ProcessRequest
public void ProcessRequest(int uid, bool isAccepted, Player arrivedFrom = null)
{
Request request;
lock (RequestsLock)
{
if (!WorldRequests.ContainsKey(uid))
return;
request = WorldRequests[uid];
request.InProgress = true;
}
// Someone tried to accept/decline request that don't belongs to him
if ((request.Target != null && request.Target != arrivedFrom)
|| (request.Target == null && !request.Owner.Party.PartyMembers.Contains(arrivedFrom)))
return;
IRequestAction action = null;
switch (request.Type)
{
case RequestType.PartyInvite:
action = new PartyAction(request);
break;
case RequestType.DuelInvite:
action = new DuelAction(request);
break;
case RequestType.GuildCreate:
action = new GuildAction(request, arrivedFrom);
break;
case RequestType.GuildInvite:
action = new GuildInviteAction(request);
break;
case RequestType.TradeStart:
action = new TradeAction(request);
break;
}
// process request
try
{
if(action == null)
return;
if (isAccepted)
action.Accepted();
else
action.Declined();
}
catch(Exception e)
{
Log.Error("Process request#{0} exception: {1}", (int)request.Type, e.ToString());
}
finally
{
// Ensure that we remove request, no matter what happens
if (!request.Blocking)
lock (RequestsLock)
UnregisterRequest(request);
}
}
示例4: OnPlayerEnterWorld
public void OnPlayerEnterWorld(IConnection connection, Player player)
{
string uidHex = BitConverter.GetBytes(player.UID).ToHex()
+ BitConverter.GetBytes(ObjectFamily.Player.GetHashCode()).ToHex();
new SendPacket("8FCD00000000").Send(connection); //1725 EU
new SendPacket("0D9600000000").Send(connection); //1725 EU
//new SpFriendList(pState.Player.Friends).Send(connection);
//new SpFriendUpdate(pState.Player.Friends).Send(connection);
new SendPacket("A7F20000000000000000").Send(connection); //1725 EU
new SendPacket("03E70000000000000000").Send(connection); //1725 EU
new SpCharacterPosition(player).Send(connection);
FlyController flyController = player.Controller as FlyController;
if (flyController != null)
flyController.EndFly(player.Position.MapId);
new SendPacket("E1EB" + uidHex + "7CC4000001FFFFFF7F").Send(connection); //1725 EU
new SpCharacterStats(player).Send(connection);
new SpCharacterGatherstats(player.PlayerCraftStats).Send(connection);
CraftService.UpdateCraftRecipes(player);
player.LastOnlineUtc = Funcs.GetRoundedUtc();
}
示例5: PlayerDied
public void PlayerDied(Player player)
{
WorldPosition bindPoint = GetNearestBindPoint(player);
player.ClosestBindPoint = bindPoint;
Global.Global.VisibleService.Send(player, new SpCreatureDied(player));
}
示例6: LoadQuest
public QuestData LoadQuest(Player player, int questId)
{
string cmdString = "SELECT * FROM questdata WHERE QuestId=?qid AND PlayerId=?pid";
MySqlCommand command = new MySqlCommand(cmdString, QuestDAOConnection);
command.Parameters.AddWithValue("?qid", questId);
command.Parameters.AddWithValue("?pid", player.Id);
MySqlDataReader reader = command.ExecuteReader();
QuestData quest = new QuestData(questId);
if (reader.HasRows)
{
while (reader.Read())
{
quest = new QuestData(questId)
{
QuestId = reader.GetInt32(1),
Status = (QuestStatus)Enum.Parse(typeof(QuestStatus), reader.GetString(2)),
Step = reader.GetInt32(3),
Counters = reader.GetString(4).Split(',').Select(n => int.Parse(n)).ToList()
};
}
}
reader.Close();
return quest;
}
示例7: LoadQuest
public QuestData LoadQuest(Player player, int questid)
{
string SQL = "SELECT * FROM `quests` WHERE "
+ "`questid` = ?qid AND `characterid` = ?pid";
MySqlCommand cmd = new MySqlCommand(SQL, QuestDAOConnection);
cmd.Parameters.AddWithValue("?qid", questid);
cmd.Parameters.AddWithValue("?pid", player.Id);
MySqlDataReader LoadQuestReader = cmd.ExecuteReader();
QuestData quest = new QuestData(questid);
if (LoadQuestReader.HasRows)
{
while (LoadQuestReader.Read())
{
quest = new QuestData(questid)
{
QuestId = LoadQuestReader.GetInt32(1),
Status = (QuestStatus)Enum.Parse(typeof(QuestStatus), LoadQuestReader.GetString(2)),
Step = LoadQuestReader.GetInt32(3),
Counters = LoadQuestReader.GetString(4).Split(',').Select(n => int.Parse(n)).ToList()
};
}
}
LoadQuestReader.Close();
return quest;
}
示例8: ApplyAbility
public void ApplyAbility(Player player)
{
foreach (var abi in player.Abilities.Values)
{
AddAbility(player, abi.Key, abi.Value);
}
}
示例9: Cancel
public void Cancel(Player player)
{
lock (TradeLock)
{
if (IsTradeFinished())
return;
SystemMessages.OpponentCanceledTheTrade(player.PlayerData.Name).Send(Player1, Player2);
lock (Storage1.ItemsLock)
{
foreach (var item in Storage1.Items.Values)
Communication.Global.StorageService.AddItem(Player1, Player1.Inventory, item);
Player1.Inventory.Money += Storage1.Money;
}
lock (Storage2.ItemsLock)
{
foreach (var item in Storage2.Items.Values)
Communication.Global.StorageService.AddItem(Player2, Player2.Inventory, item);
Player2.Inventory.Money += Storage2.Money;
}
PreRelease();
Communication.Global.ControllerService.SetController(Player1, new DefaultController());
Communication.Global.ControllerService.SetController(Player2, new DefaultController());
PostRelease();
}
}
示例10: GetParticipantMonsters
public override List<int> GetParticipantMonsters(Player player)
{
if (IsCountersComplete(player))
return new List<int>();
return new List<int>(Task.DroppedFrom);
}
示例11: GetParticipantVillagers
public override List<int> GetParticipantVillagers(Player player)
{
if (!IsCountersComplete(player))
return new List<int>();
return new List<int> {Task.DeliverToFullId};
}
示例12: SpTradeHideWindow
public SpTradeHideWindow(Player player1, Player player2, int tradeId, int type = 1)
{
Player1 = player1;
Player2 = player2;
TradeId = tradeId;
Type = type;
}
示例13: TrySetDefaultController
public void TrySetDefaultController(Player player)
{
if (player.Controller is DefaultController)
return;
SetController(player, new DefaultController());
}
示例14: PlayerEndGame
public void PlayerEndGame(Player player)
{
//todo Maybe better create a callback in IController? smth like OnEndGame?
if(player.Controller is PlayerTradeController)
((PlayerTradeController)player.Controller).Cancel(player);
SetController(player, null);
}
示例15: RemoveItem
public void RemoveItem(Player player, int slot, int count)
{
if (!(player.Controller is PlayerTradeController))
return;
((PlayerTradeController)player.Controller).RemoveItem(player, slot, count);
}