本文整理汇总了C#中Tera.Data.Structures.Player.Player类的典型用法代码示例。如果您正苦于以下问题:C# Player类的具体用法?C# Player怎么用?C# Player使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Player类属于Tera.Data.Structures.Player命名空间,在下文中一共展示了Player类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Release
public virtual void Release()
{
Creature = null;
Npc = null;
Player = null;
Random = null;
}
示例2: RemoveItem
public void RemoveItem(Player player, int slot, int count)
{
if (!(player.Controller is PlayerTradeController))
return;
((PlayerTradeController)player.Controller).RemoveItem(player, slot, count);
}
示例3: Cancel
public void Cancel(Player player)
{
if (!(player.Controller is PlayerTradeController))
return;
((PlayerTradeController)player.Controller).Cancel(player);
}
示例4: 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();
}
}
示例5: ResendQuestData
public void ResendQuestData(Player player)
{
List<int> completed = new List<int>();
foreach (var questData in player.Quests.Values)
{
if (questData.Status != QuestStatus.Complete)
{
new SpQuest(questData,
null,
1,
Quests[questData.QuestId].GetNowStep(player).IsCountersComplete(player))
.Send(player.Connection);
continue;
}
if (Data.Data.Quests[questData.QuestId].Type != QuestType.Mission)
continue;
completed.Add(questData.QuestId);
}
PlayerLevelUp(player);
new SpComplitedQuests(completed).Send(player.Connection);
}
示例6: GetParticipantVillagers
public override List<int> GetParticipantVillagers(Player player)
{
if (!IsCountersComplete(player))
return new List<int>();
return new List<int> {Task.DeliverToFullId};
}
示例7: SaveSkill
public void SaveSkill(Player player, int SkillId)
{
string cmdString = "SELECT * FROM skills WHERE SkillId=?sid AND PlayerId=?pid";
MySqlCommand command = new MySqlCommand(cmdString, SkillsDAOConnection);
command.Parameters.AddWithValue("?sid", SkillId);
command.Parameters.AddWithValue("?pid", player.Id);
MySqlDataReader SkillDAOreader = command.ExecuteReader();
bool isExists = SkillDAOreader.HasRows;
SkillDAOreader.Close();
if (!isExists)
{
cmdString = "INSERT INTO skills (PlayerId, SkillId) VALUES (?pid, ?sid)";
command = new MySqlCommand(cmdString, SkillsDAOConnection);
command.Parameters.AddWithValue("?sid", SkillId);
command.Parameters.AddWithValue("?pid", player.Id);
try
{
command.ExecuteNonQuery();
}
catch (MySqlException ex)
{
Logger.WriteLine(LogState.Exception, "SaveQuest Error"+ ex.Message);
}
}
}
示例8: 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;
}
示例9: AddStartItemsToPlayer
public void AddStartItemsToPlayer(Player player)
{
player.Inventory.Items.Add(20, new StorageItem {ItemId = 125, Amount = 5});
player.Inventory.Items.Add(21, new StorageItem { ItemId = 8007, Amount = 3 });
switch (player.PlayerData.Class)
{
case PlayerClass.Warrior:
player.Inventory.Items.Add(1, new StorageItem { ItemId = 10001, Amount = 1 });
player.Inventory.Items.Add(3, new StorageItem { ItemId = 15004, Amount = 1 });
player.Inventory.Items.Add(4, new StorageItem { ItemId = 15005, Amount = 1 });
player.Inventory.Items.Add(5, new StorageItem { ItemId = 15006, Amount = 1 });
break;
case PlayerClass.Archer:
player.Inventory.Items.Add(1, new StorageItem { ItemId = 10006, Amount = 1 });
player.Inventory.Items.Add(3, new StorageItem { ItemId = 15004, Amount = 1 });
player.Inventory.Items.Add(4, new StorageItem { ItemId = 15005, Amount = 1 });
player.Inventory.Items.Add(5, new StorageItem { ItemId = 15006, Amount = 1 });
break;
case PlayerClass.Slayer:
player.Inventory.Items.Add(1, new StorageItem { ItemId = 10003, Amount = 1 });
player.Inventory.Items.Add(3, new StorageItem { ItemId = 15004, Amount = 1 });
player.Inventory.Items.Add(4, new StorageItem { ItemId = 15005, Amount = 1 });
player.Inventory.Items.Add(5, new StorageItem { ItemId = 15006, Amount = 1 });
break;
case PlayerClass.Berserker:
player.Inventory.Items.Add(1, new StorageItem { ItemId = 10004, Amount = 1 });
player.Inventory.Items.Add(3, new StorageItem { ItemId = 15001, Amount = 1 });
player.Inventory.Items.Add(4, new StorageItem { ItemId = 15002, Amount = 1 });
player.Inventory.Items.Add(5, new StorageItem { ItemId = 15003, Amount = 1 });
break;
case PlayerClass.Lancer:
player.Inventory.Items.Add(1, new StorageItem { ItemId = 10002, Amount = 1 });
player.Inventory.Items.Add(3, new StorageItem { ItemId = 15001, Amount = 1 });
player.Inventory.Items.Add(4, new StorageItem { ItemId = 15002, Amount = 1 });
player.Inventory.Items.Add(5, new StorageItem { ItemId = 15003, Amount = 1 });
break;
case PlayerClass.Sorcerer:
player.Inventory.Items.Add(1, new StorageItem { ItemId = 10005, Amount = 1 });
player.Inventory.Items.Add(3, new StorageItem { ItemId = 15007, Amount = 1 });
player.Inventory.Items.Add(4, new StorageItem { ItemId = 15008, Amount = 1 });
player.Inventory.Items.Add(5, new StorageItem { ItemId = 15009, Amount = 1 });
break;
case PlayerClass.Mystic:
player.Inventory.Items.Add(1, new StorageItem { ItemId = 10008, Amount = 1 });
player.Inventory.Items.Add(3, new StorageItem { ItemId = 15007, Amount = 1 });
player.Inventory.Items.Add(4, new StorageItem { ItemId = 15008, Amount = 1 });
player.Inventory.Items.Add(5, new StorageItem { ItemId = 15009, Amount = 1 });
break;
case PlayerClass.Priest:
player.Inventory.Items.Add(1, new StorageItem { ItemId = 10007, Amount = 1 });
player.Inventory.Items.Add(3, new StorageItem { ItemId = 15007, Amount = 1 });
player.Inventory.Items.Add(4, new StorageItem { ItemId = 15008, Amount = 1 });
player.Inventory.Items.Add(5, new StorageItem { ItemId = 15009, Amount = 1 });
break;
}
}
示例10: FinishDuel
public void FinishDuel(Player winner)
{
if(winner.Duel == null)
return;
Duel d = winner.Duel;
SendDuelEnd(d);
SystemMessages.DuelWon.Send(winner);
SystemMessages.DuelLost.Send(d.Initiator.Equals(winner) ? d.Initiated : winner);
d.Initiator.Duel = null;
d.Initiated.Duel = null;
Communication.Global.RelationService.ResendRelation(d.Initiator);
Communication.Global.RelationService.ResendRelation(d.Initiated);
if(d.Initiator.Controller is BattleController)
((BattleController)d.Initiator.Controller).RemoveTarget(d.Initiated);
if (d.Initiated.Controller is BattleController)
((BattleController)d.Initiated.Controller).RemoveTarget(d.Initiator);
lock (DuelsLock)
Duels.Remove(d);
Communication.Global.ActionEngine.RemoveRequest(d.Request);
}
示例11: AddQuests
public void AddQuests(Player player)
{
foreach (var quest in player.Quests.ToList())
{
AddQuest(player, quest.Value);
}
}
示例12: ProcessDamage
public void ProcessDamage(Player player)
{
if(player.Duel == null)
return;
player.Duel.LastKickUtc = RandomUtilities.GetCurrentMilliseconds();
}
示例13: 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)
{
Logger.WriteLine(LogState.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);
}
}
示例14: AddNewParty
public void AddNewParty(Player inviter, List<Player> invitedPlayers)
{
AddNewParty(inviter, invitedPlayers[0]);
for (int i = 1; i < invitedPlayers.Count; i++)
AddPlayerToParty(invitedPlayers[i], ref inviter.Party);
}
示例15: AddItem
public bool AddItem(Player player, StorageType type, KeyValuePair<int, StorageItem> KeyVP)
{
string SQL = "INSERT INTO `inventory` "
+ "(`accountname`, `playerid`, `itemid`, `amount`, `color`, `slot`, `storagetype`) "
+ "VALUES(?accountname, ?pid, ?itemid, ?amount, ?color, ?slot, ?type);";
MySqlCommand cmd = new MySqlCommand(SQL, InventoryDAOConnection);
cmd.Parameters.AddWithValue("?accountname", player.AccountName);
cmd.Parameters.AddWithValue("?pid", player.Id);
cmd.Parameters.AddWithValue("?itemid", KeyVP.Value.ItemId);
cmd.Parameters.AddWithValue("?amount", KeyVP.Value.Amount);
cmd.Parameters.AddWithValue("?color", KeyVP.Value.Color);
cmd.Parameters.AddWithValue("?slot", KeyVP.Key);
cmd.Parameters.AddWithValue("?type", type.ToString());
try
{
cmd.ExecuteNonQuery();
return true;
}
catch (Exception ex)
{
Logger.WriteLine(LogState.Exception, "DAO: ADD ITEM ERROR!"+ ex.Message);
}
return false;
}