当前位置: 首页>>代码示例>>C#>>正文


C# Player.Player类代码示例

本文整理汇总了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;
 }
开发者ID:arkanoid1,项目名称:Temu,代码行数:7,代码来源:DefaultAi.cs

示例2: RemoveItem

        public void RemoveItem(Player player, int slot, int count)
        {
            if (!(player.Controller is PlayerTradeController))
                return;

            ((PlayerTradeController)player.Controller).RemoveItem(player, slot, count);
        }
开发者ID:arkanoid1,项目名称:Temu,代码行数:7,代码来源:TradeService.cs

示例3: Cancel

        public void Cancel(Player player)
        {
            if (!(player.Controller is PlayerTradeController))
                return;

            ((PlayerTradeController)player.Controller).Cancel(player);
        }
开发者ID:arkanoid1,项目名称:Temu,代码行数:7,代码来源:TradeService.cs

示例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();
            }
        }
开发者ID:arkanoid1,项目名称:Temu,代码行数:31,代码来源:PlayerTradeController.cs

示例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);
        }
开发者ID:arkanoid1,项目名称:Temu,代码行数:27,代码来源:QuestEngine.cs

示例6: GetParticipantVillagers

        public override List<int> GetParticipantVillagers(Player player)
        {
            if (!IsCountersComplete(player))
                return new List<int>();

            return new List<int> {Task.DeliverToFullId};
        }
开发者ID:arkanoid1,项目名称:Temu,代码行数:7,代码来源:QStepHuntingDelivery.cs

示例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);
                }
            }
        }
开发者ID:arkanoid1,项目名称:Temu,代码行数:27,代码来源:SkillsDAO.cs

示例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;
        }
开发者ID:arkanoid1,项目名称:Temu,代码行数:27,代码来源:QuestDAO.cs

示例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;
            }
        }
开发者ID:arkanoid1,项目名称:Temu,代码行数:60,代码来源:StorageService.cs

示例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);
        }
开发者ID:arkanoid1,项目名称:Temu,代码行数:27,代码来源:DuelService.cs

示例11: AddQuests

 public void AddQuests(Player player)
 {
     foreach (var quest in player.Quests.ToList())
     {
         AddQuest(player, quest.Value);
     }
 }
开发者ID:arkanoid1,项目名称:Temu,代码行数:7,代码来源:QuestDAO.cs

示例12: ProcessDamage

        public void ProcessDamage(Player player)
        {
            if(player.Duel == null)
                return;

            player.Duel.LastKickUtc = RandomUtilities.GetCurrentMilliseconds();
        }
开发者ID:arkanoid1,项目名称:Temu,代码行数:7,代码来源:DuelService.cs

示例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);
            }
        }
开发者ID:arkanoid1,项目名称:Temu,代码行数:60,代码来源:ActionEngine.cs

示例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);
        }
开发者ID:arkanoid1,项目名称:Temu,代码行数:7,代码来源:PartyService.cs

示例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;
        }
开发者ID:arkanoid1,项目名称:Temu,代码行数:26,代码来源:InventoryDAO.cs


注:本文中的Tera.Data.Structures.Player.Player类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。