コード例 #1
0
 public bool CanSell(Item.ItemInformation item)
 {
     foreach (string ItemType in BuysItemTypes)
     {
         if (ItemType == item.Type)
         {
             return(true);
         }
     }
     return(false);
 }
コード例 #2
0
        public void AddInfinity(Item.ItemInformation itemInfo)
        {
            if (HasItemId(itemInfo.Id))
            {
                return;
            }

            InventoryItem inventoryItem = new InventoryItem();

            inventoryItem.ItemId   = itemInfo.Id;
            inventoryItem.Infinite = true;

            for (int i = 0; i < 25; i++) // add 25
            {
                inventoryItem.AddItem(new ItemInstance(inventoryItem.ItemId));
            }

            inventoryItems.Add(inventoryItem);
        }
コード例 #3
0
            private int getOffsetFrom(Item.ItemInformation tackPeice)
            {
                int offsetBy = 0;

                foreach (Item.Effects effect in tackPeice.Effects)
                {
                    string effects = effect.EffectsWhat;
                    switch (effects)
                    {
                    case "AGILITY":
                        if (horseStat == StatType.AGILITY)
                        {
                            offsetBy += effect.EffectAmount;
                        }
                        break;

                    case "CONFORMATION":
                        if (horseStat == StatType.CONFORMATION)
                        {
                            offsetBy += effect.EffectAmount;
                        }
                        break;

                    case "ENDURANCE":
                        if (horseStat == StatType.ENDURANCE)
                        {
                            offsetBy += effect.EffectAmount;
                        }
                        break;

                    case "PERSONALITY":
                        if (horseStat == StatType.PERSONALITY)
                        {
                            offsetBy += effect.EffectAmount;
                        }
                        break;

                    case "SPEED":
                        if (horseStat == StatType.SPEED)
                        {
                            offsetBy += effect.EffectAmount;
                        }
                        break;

                    case "STRENGTH":
                        if (horseStat == StatType.STRENGTH)
                        {
                            offsetBy += effect.EffectAmount;
                        }
                        break;

                    case "INTELLIGENCE":
                        if (horseStat == StatType.INTELIGENCE)
                        {
                            offsetBy += effect.EffectAmount;
                        }
                        break;
                    }
                }
                return(offsetBy);
            }
コード例 #4
0
ファイル: Inn.cs プロジェクト: Illya9999/HISP
 public int CalculateBuyCost(Item.ItemInformation item)
 {
     return((int)Math.Floor((float)item.SellPrice * (100.0 / (float)BuyPercentage)));
 }
コード例 #5
0
 public int CalculateSellCost(Item.ItemInformation item)
 {
     return((int)Math.Round((float)item.SellPrice * (100.0 / (float)SellPricePercentage)));
 }
コード例 #6
0
ファイル: Shop.cs プロジェクト: KuromeSan/HISP
 public UInt64 CalculateSellCost(Item.ItemInformation item)
 {
     return(Convert.ToUInt64(Math.Round((double)item.SellPrice * (100.0 / (double)SellPricePercentage))));
 }
コード例 #7
0
        public static QuestResult CompleteQuest(User user, QuestEntry quest, bool npcActivation = false, QuestResult res = null)
        {
            if (res == null)
            {
                res = new QuestResult();
            }
            // Take Items
            foreach (QuestItemInfo itemInfo in quest.ItemsRequired)
            {
                InventoryItem itm = user.Inventory.GetItemByItemId(itemInfo.ItemId);
                for (int i = 0; i < itemInfo.Quantity; i++)
                {
                    user.Inventory.Remove(itm.ItemInstances[0]);
                }
            }
            // Take Money
            user.TakeMoney(quest.MoneyCost);
            // Give money
            user.AddMoney(quest.MoneyEarned);
            // Give items
            foreach (QuestItemInfo itemInfo in quest.ItemsEarned)
            {
                for (int i = 0; i < itemInfo.Quantity; i++)
                {
                    ItemInstance         itm             = new ItemInstance(itemInfo.ItemId);
                    Item.ItemInformation itemInformation = itm.GetItemInfo();
                    if (itemInformation.Type == "CONCEPTUAL")
                    {
                        Item.ConsumeItem(user, itemInformation);
                    }
                    else
                    {
                        user.Inventory.AddIgnoringFull(itm);
                    }
                }
            }
            if (quest.WarpX != 0 && quest.WarpY != 0)
            {
                user.Teleport(quest.WarpX, quest.WarpY);
            }

            // Give quest points
            user.QuestPoints += quest.QuestPointsEarned;

            res.QuestCompleted = true;
            if (npcActivation)
            {
                if (quest.SuccessNpcChat != null && quest.SuccessNpcChat != "")
                {
                    res.NpcChat = quest.SuccessNpcChat;
                }

                if (quest.SetNpcChatpoint != -1)
                {
                    res.SetChatpoint = quest.SetNpcChatpoint;
                }

                if (quest.GotoNpcChatpoint != -1)
                {
                    res.GotoChatpoint = quest.GotoNpcChatpoint;
                }
            }

            if (quest.Tracked)
            {
                user.Quests.TrackQuest(quest.Id);
            }

            if (quest.ChainedQuestId != 0)
            {
                res = ActivateQuest(user, Quest.GetQuestById(quest.ChainedQuestId), npcActivation, res);
            }

            if (quest.SuccessMessage != null)
            {
                byte[] ChatPacket = PacketBuilder.CreateChat(quest.SuccessMessage, PacketBuilder.CHAT_BOTTOM_RIGHT);
                user.LoggedinClient.SendPacket(ChatPacket);
            }

            if (quest.SuccessNpcChat != null)
            {
                if (!npcActivation)
                {
                    byte[] ChatPacket = PacketBuilder.CreateChat(quest.SuccessNpcChat, PacketBuilder.CHAT_BOTTOM_RIGHT);
                    user.LoggedinClient.SendPacket(ChatPacket);
                }
            }

            // Check if award unlocked
            int questPointsPercent = Convert.ToInt32(Math.Floor(((decimal)user.QuestPoints / (decimal)GetTotalQuestPoints()) * (decimal)100.0));

            if (questPointsPercent >= 25)
            {
                user.Awards.AddAward(Award.GetAwardById(1)); // 25% Quest Completion Award.
            }
            if (questPointsPercent >= 50)
            {
                user.Awards.AddAward(Award.GetAwardById(2)); // 50% Quest Completion Award.
            }
            if (questPointsPercent >= 75)
            {
                user.Awards.AddAward(Award.GetAwardById(3)); // 75% Quest Completion Award.
            }
            if (questPointsPercent >= 100)
            {
                user.Awards.AddAward(Award.GetAwardById(4)); // 100% Quest Completion Award.
            }
            // Is cloud isles quest?
            if (quest.Id == 1373)
            {
                byte[] swfLoadPacket = PacketBuilder.CreateSwfModulePacket("ballooncutscene", PacketBuilder.PACKET_SWF_CUTSCENE);
                user.LoggedinClient.SendPacket(swfLoadPacket);
            }

            return(res);
        }