public static List <string> givePartyCP(PlayerModel pm, int cp)
        {
            List <int>    partyUniqs   = new List <int>();
            PartyModel    currentParty = pm.getActiveParty();
            List <string> results      = new List <string>();

            foreach (PartyCharacterModel pcm in currentParty.characters)
            {
                results.AddRange(giveXPCP(pm, pcm.characterUniq, 0, cp));
            }

            return(results);
        }
Пример #2
0
        private void updateDataModels()
        {
            //Update the models list
            foreach (CombatCharacterModel ccm in combatCharacterModels)
            {
                foreach (int key in pcs.Keys)
                {
                    FullCombatCharacter fcc = pcs[key];
                    if (fcc.characterUniq == ccm.characterUniq)
                    {
                        ccm.nextAttackTime = fcc.nextAttackTime;
                        ccm.stats.hp       = fcc.hp;
                        ccm.stats.mp       = fcc.mp;
                        ccm.name           = fcc.name;
                        ccm.classType      = fcc.className;
                    }
                }
            }

            foreach (PartyCharacterModel pcm in playerModel.getActiveParty().characters)
            {
                foreach (int key in pcs.Keys)
                {
                    FullCombatCharacter fcc = pcs[key];
                    if (fcc.characterUniq == pcm.characterUniq)
                    {
                        pcm.usedAbilities = fcc.usedAbilities;
                    }
                }
            }

            foreach (CombatCharacterModel ccm in combatNPCModels)
            {
                foreach (int key in npcs.Keys)
                {
                    FullCombatCharacter fcc = npcs[key];
                    if (fcc.combatUniq == ccm.combatUniq)
                    {
                        ccm.nextAttackTime = fcc.nextAttackTime;
                        ccm.stats.hp       = fcc.hp;
                        ccm.stats.mp       = fcc.mp;
                    }
                }
            }

            onUpdate();
        }
        public static void processEvent(MapEventModel currentEvent, PlayerModel player, ref List <ClientMessage> messageQueue)
        {
            switch (currentEvent.rewardType)
            {
            case MapDataClasses.ClientEvent.RewardType.Objective:
                string returnValue = ObjectiveDirector.completeObjective(player, currentEvent.eventData.objective);
                if (returnValue != string.Empty)
                {
                    messageQueue.Add(new ClientMessage()
                    {
                        message = returnValue,
                        type    = ClientMessage.ClientMessageType.Message
                    });
                    messageQueue.Add(new ClientMessage()
                    {
                        type = ClientMessage.ClientMessageType.RefreshMap
                    });
                }
                break;

            case MapDataClasses.ClientEvent.RewardType.XP:
                messageQueue.Add(new ClientMessage()
                {
                    message = "All characters have gained " + currentEvent.rewardValue.ToString() + " XP!",
                    type    = ClientMessage.ClientMessageType.Message
                });
                messageQueue.Add(new ClientMessage()
                {
                    type = ClientMessage.ClientMessageType.RefreshMap
                });
                List <string> results = PlayerDataManager.givePartyXP(player, currentEvent.rewardValue);
                foreach (string s in results)
                {
                    messageQueue.Add(new ClientMessage()
                    {
                        message = s
                    });
                }
                break;

            case MapDataClasses.ClientEvent.RewardType.CP:
                messageQueue.Add(new ClientMessage()
                {
                    message = "All characters have gained " + currentEvent.rewardValue.ToString() + " CP!",
                    type    = ClientMessage.ClientMessageType.Message
                });
                messageQueue.Add(new ClientMessage()
                {
                    type = ClientMessage.ClientMessageType.RefreshMap
                });
                List <string> cpResults = PlayerDataManager.givePartyCP(player, currentEvent.rewardValue);
                foreach (string s in cpResults)
                {
                    messageQueue.Add(new ClientMessage()
                    {
                        message = s
                    });
                }
                break;

            case MapDataClasses.ClientEvent.RewardType.Gold:
                messageQueue.Add(new ClientMessage()
                {
                    message = "You have found " + currentEvent.rewardValue.ToString() + " GP!",
                    type    = ClientMessage.ClientMessageType.Message
                });
                messageQueue.Add(new ClientMessage()
                {
                    type = ClientMessage.ClientMessageType.RefreshMap
                });
                PlayerDataManager.givePartyGP(player, currentEvent.rewardValue);
                break;
            }
            player.getActiveParty().location.eventCollection.removeEvent(currentEvent);
            player.getActiveParty().location.activeEvent = null;
        }
 public static void processEvent(MapEventModel currentEvent, PlayerModel player, ref List<ClientMessage> messageQueue)
 {
     switch (currentEvent.rewardType)
     {
         case MapDataClasses.ClientEvent.RewardType.Objective:
             string returnValue = ObjectiveDirector.completeObjective(player, currentEvent.eventData.objective);
             if (returnValue != string.Empty)
             {
                 messageQueue.Add(new ClientMessage()
                 {
                     message = returnValue,
                     type = ClientMessage.ClientMessageType.Message
                 });
                 messageQueue.Add(new ClientMessage()
                 {
                     type = ClientMessage.ClientMessageType.RefreshMap
                 });
             }
             break;
         case MapDataClasses.ClientEvent.RewardType.XP:
             messageQueue.Add(new ClientMessage()
             {
                 message = "All characters have gained " + currentEvent.rewardValue.ToString() + " XP!",
                 type = ClientMessage.ClientMessageType.Message
             });
             messageQueue.Add(new ClientMessage()
             {
                 type = ClientMessage.ClientMessageType.RefreshMap
             });
             List<string> results = PlayerDataManager.givePartyXP(player, currentEvent.rewardValue);
             foreach (string s in results)
             {
                 messageQueue.Add(new ClientMessage()
                 {
                     message = s
                 });
             }
             break;
         case MapDataClasses.ClientEvent.RewardType.CP:
             messageQueue.Add(new ClientMessage()
             {
                 message = "All characters have gained " + currentEvent.rewardValue.ToString() + " CP!",
                 type = ClientMessage.ClientMessageType.Message
             });
             messageQueue.Add(new ClientMessage()
             {
                 type = ClientMessage.ClientMessageType.RefreshMap
             });
             List<string> cpResults = PlayerDataManager.givePartyCP(player, currentEvent.rewardValue);
             foreach (string s in cpResults)
             {
                 messageQueue.Add(new ClientMessage()
                 {
                     message = s
                 });
             }
             break;
         case MapDataClasses.ClientEvent.RewardType.Gold:
             messageQueue.Add(new ClientMessage()
             {
                 message = "You have found " + currentEvent.rewardValue.ToString() + " GP!",
                 type = ClientMessage.ClientMessageType.Message
             });
             messageQueue.Add(new ClientMessage()
             {
                 type = ClientMessage.ClientMessageType.RefreshMap
             });
             PlayerDataManager.givePartyGP(player, currentEvent.rewardValue);
             break;
     }
     player.getActiveParty().location.eventCollection.removeEvent(currentEvent);
     player.getActiveParty().location.activeEvent = null;
 }
        public static List<string> givePartyXP(PlayerModel pm, int xp)
        {
            List<int> partyUniqs = new List<int>();
            PartyModel currentParty = pm.getActiveParty();
            List<string> results = new List<string>();
            foreach (PartyCharacterModel pcm in currentParty.characters)
            {
                results.AddRange(giveXPCP(pm, pcm.characterUniq, xp, 0));
            }

            return results;
        }