Esempio n. 1
0
        /// <summary>
        /// Apply all needed magical bonus to the item
        /// </summary>
        /// <param name="player"></param>
        /// <param name="item"></param>
        /// <returns></returns>
        protected override void ApplyMagicalEffect(GamePlayer player, InventoryItem item)
        {
            if (item == null || player.TradeWindow.TradeItems[0] == null)
            {
                return;                                                                     // be sure at least one item in each side
            }
            if (((InventoryItem)player.TradeWindow.TradeItems[0]).Model == 525)             // Echant item
            {
                ApplyMagicalDusts(player, item);
            }
            else if (((InventoryItem)player.TradeWindow.TradeItems[0]).Object_Type == (int)eObjectType.SpellcraftGem)             // Spellcraft item
            {
                ApplySpellcraftGems(player, item);
            }

            if (item.Template is ItemUnique)
            {
                GameServer.Database.SaveObject(item);
                GameServer.Database.SaveObject(item.Template as ItemUnique);
            }
            else
            {
                ChatUtil.SendErrorMessage(player, "Spellcrafting error: Item was not an ItemUnique, crafting changes not saved to DB!");
                log.ErrorFormat("Spellcrafting error: Item {0} was not an ItemUnique for player {1}, crafting changes not saved to DB!", item.Id_nb, player.Name);
            }
        }
Esempio n. 2
0
        protected virtual bool CheckForResist(InventoryItem item, int resist)
        {
            switch (resist)
            {
            case 0: return(CheckForProperty(item, (int)eProperty.Resist_Body));

            case 1: return(CheckForProperty(item, (int)eProperty.Resist_Cold));

            case 2: return(CheckForProperty(item, (int)eProperty.Resist_Heat));

            case 3: return(CheckForProperty(item, (int)eProperty.Resist_Energy));

            case 4: return(CheckForProperty(item, (int)eProperty.Resist_Matter));

            case 5: return(CheckForProperty(item, (int)eProperty.Resist_Spirit));

            case 6: return(CheckForProperty(item, (int)eProperty.Resist_Thrust));

            case 7: return(CheckForProperty(item, (int)eProperty.Resist_Crush));

            case 8: return(CheckForProperty(item, (int)eProperty.Resist_Slash));

            default:

                log.Error("There has been an unexpected resist passed to CheckForResist: " + resist);
                ChatUtil.SendErrorMessage(m_searchPlayer, "Unhandled resist (" + resist + ") specified in search!");
                m_searchHasError = true;
                break;
            }

            return(false);
        }
Esempio n. 3
0
        /// <summary>
        /// Apply all needed magical bonus to the item
        /// </summary>
        /// <param name="player"></param>
        /// <param name="item"></param>
        /// <returns></returns>
        protected override void ApplyMagicalEffect(GamePlayer player, InventoryItem item)
        {
            InventoryItem tincture = (InventoryItem)player.TradeWindow.TradeItems[0];

            // One item each side of the trade window.
            if (item == null || tincture == null)
            {
                return;
            }

            if (tincture.ProcSpellID != 0)
            {
                item.ProcSpellID = tincture.ProcSpellID;
            }
            else
            {
                item.MaxCharges = GetItemMaxCharges(item);
                item.Charges    = item.MaxCharges;
                item.SpellID    = tincture.SpellID;
            }

            player.Inventory.RemoveCountFromStack(tincture, 1);
            InventoryLogging.LogInventoryAction(player, "(craft)", eInventoryActionType.Craft, tincture.Template);

            if (item.Template is ItemUnique)
            {
                GameServer.Database.SaveObject(item);
                GameServer.Database.SaveObject(item.Template as ItemUnique);
            }
            else
            {
                ChatUtil.SendErrorMessage(player, "Alchemy crafting error: Item was not an ItemUnique, crafting changes not saved to DB!");
                log.ErrorFormat("Alchemy crafting error: Item {0} was not an ItemUnique for player {1}, crafting changes not saved to DB!", item.Id_nb, player.Name);
            }
        }
Esempio n. 4
0
        protected virtual bool CheckSlot(InventoryItem item, int slot)
        {
            if (slot != -1)
            {
                switch (slot)
                {
                case 0: return(item.Item_Type == (int)eInventorySlot.HandsArmor);

                case 1: return(item.Item_Type == (int)eInventorySlot.FeetArmor);

                case 2: return(item.Item_Type == (int)eInventorySlot.HeadArmor);

                case 3: return(item.Item_Type == (int)eInventorySlot.ArmsArmor);

                case 4: return(item.Item_Type == (int)eInventorySlot.LegsArmor);

                case 5: return(item.Item_Type == (int)eInventorySlot.TorsoArmor);

                case 6: return(item.Object_Type == (int)eObjectType.Magical && (item.Item_Type == (int)eInventorySlot.RightRing || item.Item_Type == (int)eInventorySlot.LeftRing));

                case 7: return(item.Object_Type == (int)eObjectType.Magical && (item.Item_Type == (int)eInventorySlot.RightBracer || item.Item_Type == (int)eInventorySlot.LeftBracer));

                case 8: return(item.Object_Type == (int)eObjectType.Magical && item.Item_Type == (int)eInventorySlot.Waist);

                case 9: return(item.Object_Type == (int)eObjectType.Magical && item.Item_Type == (int)eInventorySlot.Neck);

                case 10: return(item.Object_Type == (int)eObjectType.Magical && item.Item_Type == (int)eInventorySlot.Cloak);

                case 11: return(item.Object_Type == (int)eObjectType.Magical && item.Item_Type == (int)eInventorySlot.Jewellery);

                case 12: return(item.Item_Type == (int)eInventorySlot.RightHandWeapon || item.Item_Type == (int)eInventorySlot.LeftHandWeapon || item.Item_Type == (int)eInventorySlot.TwoHandWeapon);

                case 13: return(item.Object_Type == (int)eObjectType.Shield && item.Item_Type == (int)eInventorySlot.LeftHandWeapon);

                case 14: return(item.Item_Type == (int)eInventorySlot.TwoHandWeapon);

                case 15: return(item.Item_Type == (int)eInventorySlot.DistanceWeapon);

                case 16: return(item.Item_Type == (int)eInventorySlot.LeftHandWeapon);

                case 17: return(item.Object_Type == (int)eObjectType.Instrument && item.Item_Type == (int)eInventorySlot.RightHandWeapon);

                case 18: return(item.Object_Type == (int)eObjectType.GenericItem);

                default:

                    log.Error("There has been an unexpected slot passed to CheckSlot: " + slot);
                    ChatUtil.SendErrorMessage(m_searchPlayer, "Unhandled slot (" + slot + ") specified in search!");
                    m_searchHasError = true;
                    break;
                }
            }

            return(true);
        }
Esempio n. 5
0
        /// <summary>
        /// What to do after an item is added.  For consignment merchants this is called after price is set
        /// </summary>
        /// <param name="player"></param>
        /// <param name="clientSlot"></param>
        /// <param name="price"></param>
        /// <returns></returns>
        public virtual bool SetSellPrice(GamePlayer player, ushort clientSlot, uint price)
        {
            GameConsignmentMerchant conMerchant = player.ActiveInventoryObject as GameConsignmentMerchant;

            if (conMerchant == null)
            {
                return(false);
            }
            House house = HouseMgr.GetHouse(conMerchant.HouseNumber);

            if (house == null)
            {
                return(false);
            }

            if (house.HasOwnerPermissions(player) == false)
            {
                return(false);
            }

            InventoryItem item = player.TempProperties.getProperty <InventoryItem>(GameInventoryObjectExtensions.ITEM_BEING_ADDED, null);

            if (item != null)
            {
                if (item.IsTradable)
                {
                    item.SellPrice = (int)price;
                }
                else
                {
                    // Unique DOL feature
                    item.SellPrice = 0;
                    player.Out.SendCustomDialog("This item is not tradable. You can store it here but cannot sell it.", null);
                }

                item.OwnerLot = conMerchant.HouseNumber;
                item.OwnerID  = conMerchant.GetOwner(player);
                GameServer.Database.SaveObject(item);
                ChatUtil.SendDebugMessage(player, item.Name + " SellPrice=" + price + ", OwnerLot=" + item.OwnerLot + ", OwnerID=" + item.OwnerID);
                player.Out.SendMessage("Price set!", eChatType.CT_System, eChatLoc.CL_SystemWindow);

                if (ServerProperties.Properties.MARKET_ENABLE_LOG)
                {
                    log.DebugFormat("CM: {0}:{1} set sell price of '{2}' to {3} for consignment merchant on lot {4}.", player.Name, player.Client.Account.Name, item.Name, item.SellPrice, HouseNumber);
                }

                NotifyObservers(player, null);
            }


            return(true);
        }
Esempio n. 6
0
        protected virtual void SendInteractMessage(GamePlayer player)
        {
            string text = "";

            if (m_moneyItem == null || m_moneyItem.Item == null)
            {
                text = LanguageMgr.GetTranslation(player.Client.Account.Language, "GameMerchant.GetExamineMessages.Nothing");
                ChatUtil.SendDebugMessage(player, "MoneyItem is null!");
            }
            else
            {
                text = MoneyItemName + "s";
            }

            player.Out.SendMessage(LanguageMgr.GetTranslation(player.Client.Account.Language, "GameMerchant.GetExamineMessages.BuyItemsFor", this.Name, text), eChatType.CT_Say, eChatLoc.CL_ChatWindow);
        }
Esempio n. 7
0
        /// <summary>
        /// Move an item from the inventory object to a player's backpack (uses client slots)
        /// </summary>
        public static IDictionary <int, InventoryItem> MoveItemFromObject(this IGameInventoryObject thisObject, GamePlayer player, eInventorySlot fromClientSlot, eInventorySlot toClientSlot)
        {
            // We will only allow moving to the backpack.

            if (toClientSlot < eInventorySlot.FirstBackpack || toClientSlot > eInventorySlot.LastBackpack)
            {
                return(null);
            }

            lock (thisObject.LockObject())
            {
                Dictionary <int, InventoryItem> inventory = thisObject.GetClientInventory(player);

                if (inventory.ContainsKey((int)fromClientSlot) == false)
                {
                    ChatUtil.SendErrorMessage(player, "Item not found in slot " + (int)fromClientSlot);
                    return(null);
                }

                InventoryItem fromItem = inventory[(int)fromClientSlot];
                InventoryItem toItem   = player.Inventory.GetItem(toClientSlot);

                // if there is an item in the players target inventory slot then move it to the object
                if (toItem != null)
                {
                    player.Inventory.RemoveTradeItem(toItem);
                    toItem.SlotPosition = fromItem.SlotPosition;
                    toItem.OwnerID      = thisObject.GetOwner(player);
                    thisObject.OnAddItem(player, toItem);
                    GameServer.Database.SaveObject(toItem);
                }

                thisObject.OnRemoveItem(player, fromItem);

                // Create the GameInventoryItem from this InventoryItem.  This simply wraps the InventoryItem,
                // which is still updated when this item is moved around
                InventoryItem objectItem = GameInventoryItem.Create <InventoryItem>(fromItem);

                player.Inventory.AddTradeItem(toClientSlot, objectItem);

                var updateItems = new Dictionary <int, InventoryItem>(1);
                updateItems.Add((int)fromClientSlot, toItem);

                return(updateItems);
            }
        }
Esempio n. 8
0
        /// <summary>
        /// The Player is buying an Item from the merchant
        /// </summary>
        /// <param name="player"></param>
        /// <param name="playerInventory"></param>
        /// <param name="fromClientSlot"></param>
        /// <param name="toClientSlot"></param>
        public virtual void OnPlayerBuy(GamePlayer player, eInventorySlot fromClientSlot, eInventorySlot toClientSlot, bool usingMarketExplorer = false)
        {
            IDictionary <int, InventoryItem> clientInventory = GetClientInventory(player);

            InventoryItem fromItem = null;

            if (clientInventory.ContainsKey((int)fromClientSlot))
            {
                fromItem = clientInventory[(int)fromClientSlot];
            }

            if (fromItem == null)
            {
                ChatUtil.SendErrorMessage(player, "I can't find the item you want to purchase!");
                log.ErrorFormat("CM: {0}:{1} can't find item to buy in slot {2} on consignment merchant on lot {3}.", player.Name, player.Client.Account, (int)fromClientSlot, HouseNumber);
                return;
            }

            string buyText = "Do you want to buy this Item?";

            // If the player has a marketExplorer activated they will be charged a commission
            if (player.TargetObject is MarketExplorer)
            {
                player.TempProperties.setProperty(CONSIGNMENT_BUY_ITEM, fromClientSlot);
                if (ServerProperties.Properties.MARKET_FEE_PERCENT > 0)
                {
                    player.Out.SendCustomDialog("Buying directly from the Market Explorer costs an additional " + ServerProperties.Properties.MARKET_FEE_PERCENT + "% fee. Do you want to buy this Item?", new CustomDialogResponse(BuyMarketResponse));
                }
                else
                {
                    player.Out.SendCustomDialog(buyText, new CustomDialogResponse(BuyResponse));
                }
            }
            else if (player.TargetObject == this)
            {
                player.TempProperties.setProperty(CONSIGNMENT_BUY_ITEM, fromClientSlot);
                player.Out.SendCustomDialog(buyText, new CustomDialogResponse(BuyResponse));
            }
            else
            {
                ChatUtil.SendErrorMessage(player, "I'm sorry, you need to be talking to a market explorer or consignment merchant in order to make a purchase.");
                log.ErrorFormat("CM: {0}:{1} did not have a CM or ME targeted when attempting to purchase {2} on consignment merchant on lot {3}.", player.Name, player.Client.Account, fromItem.Name, HouseNumber);
            }
        }
Esempio n. 9
0
        protected virtual bool CheckForDamageType(InventoryItem item, int damageType)
        {
            if (GlobalConstants.IsWeapon(item.Object_Type))
            {
                if (damageType >= 1 && damageType <= 3)
                {
                    return(damageType == item.Type_Damage);
                }
                else
                {
                    log.Error("There has been an unexpected bonus passed to CheckForDamageType: " + damageType);
                    ChatUtil.SendErrorMessage(m_searchPlayer, "Unhandled damage type (" + damageType + ") specified in search!");
                    m_searchHasError = true;
                    return(false);
                }
            }

            return(false);
        }
Esempio n. 10
0
        protected virtual bool CheckForArmorType(InventoryItem item, int type)
        {
            switch (type)
            {
            case 1:

                return(item.Object_Type == (int)eObjectType.Cloth);

            case 2:

                return(item.Object_Type == (int)eObjectType.Leather);

            case 3:

                return(item.Object_Type == (int)eObjectType.Studded);

            case 4:

                return(item.Object_Type == (int)eObjectType.Chain);

            case 5:

                return(item.Object_Type == (int)eObjectType.Plate);

            case 6:

                return(item.Object_Type == (int)eObjectType.Reinforced);

            case 7:

                return(item.Object_Type == (int)eObjectType.Scale);

            default:

                log.Error("There has been an unexpected type passed to CheckForArmorType: " + type);
                ChatUtil.SendErrorMessage(m_searchPlayer, "Unhandled armor type (" + type + ") specified in search!");
                m_searchHasError = true;
                return(false);
            }
        }
Esempio n. 11
0
        protected virtual bool CheckForBonus(InventoryItem item, int bonus)
        {
            if (bonus > 0)
            {
                switch (bonus)
                {
                case 0: return(CheckForProperty(item, (int)eProperty.Strength));

                case 1: return(CheckForProperty(item, (int)eProperty.Constitution));

                case 2: return(CheckForProperty(item, (int)eProperty.Dexterity));

                case 3: return(CheckForProperty(item, (int)eProperty.Quickness));

                case 4: return(CheckForProperty(item, (int)eProperty.Piety));

                case 5: return(CheckForProperty(item, (int)eProperty.Empathy));

                case 6: return(CheckForProperty(item, (int)eProperty.Intelligence));

                case 7: return(CheckForProperty(item, (int)eProperty.Charisma));

                case 8: return(CheckForProperty(item, (int)eProperty.Dexterity) ||
                               CheckForProperty(item, (int)eProperty.Intelligence) ||
                               CheckForProperty(item, (int)eProperty.Charisma) ||
                               CheckForProperty(item, (int)eProperty.Acuity) ||
                               CheckForProperty(item, (int)eProperty.Empathy) ||
                               CheckForProperty(item, (int)eProperty.Piety));

                case 9:
                {
                    for (int i = (int)eProperty.ToABonus_First; i <= (int)eProperty.ToABonus_Last; i++)
                    {
                        if (CheckForProperty(item, i))
                        {
                            return(true);
                        }
                    }

                    return(false);
                }

                case 10: return(CheckForProperty(item, (int)eProperty.PowerPool));

                case 11: return(CheckForProperty(item, (int)eProperty.HealingEffectiveness));

                case 12: return(CheckForProperty(item, (int)eProperty.SpellDuration));

                case 13: return(CheckForProperty(item, (int)eProperty.ArmorFactor));

                case 14: return(CheckForProperty(item, (int)eProperty.CastingSpeed));

                case 15: return(CheckForProperty(item, (int)eProperty.MeleeSpeed));

                case 16: return(CheckForProperty(item, (int)eProperty.ArcherySpeed));

                case 17: return(CheckForProperty(item, (int)eProperty.StrCapBonus) ||
                                CheckForProperty(item, (int)eProperty.DexCapBonus) ||
                                CheckForProperty(item, (int)eProperty.ConCapBonus) ||
                                CheckForProperty(item, (int)eProperty.QuiCapBonus) ||
                                CheckForProperty(item, (int)eProperty.IntCapBonus) ||
                                CheckForProperty(item, (int)eProperty.PieCapBonus) ||
                                CheckForProperty(item, (int)eProperty.EmpCapBonus) ||
                                CheckForProperty(item, (int)eProperty.ChaCapBonus) ||
                                CheckForProperty(item, (int)eProperty.AcuCapBonus) ||
                                CheckForProperty(item, (int)eProperty.MaxHealthCapBonus) ||
                                CheckForProperty(item, (int)eProperty.PowerPoolCapBonus));

                case 18: return(CheckForProperty(item, (int)eProperty.MaxHealthCapBonus));

                case 19: return(CheckForProperty(item, (int)eProperty.BuffEffectiveness));

                case 20:
                {
                    // Catacombs - for DOL this is customized to special skills not included
                    // in other searches -Tolakram

                    for (int i = (int)eProperty.MaxSpeed; i <= (int)eProperty.Acuity; i++)
                    {
                        if (CheckForProperty(item, i))
                        {
                            return(true);
                        }
                    }

                    for (int i = (int)eProperty.EvadeChance; i <= (int)eProperty.ToHitBonus; i++)
                    {
                        if (CheckForProperty(item, i))
                        {
                            return(true);
                        }
                    }

                    for (int i = (int)eProperty.DPS; i <= (int)eProperty.MaxProperty; i++)
                    {
                        if (CheckForProperty(item, i))
                        {
                            return(true);
                        }
                    }

                    return(false);
                }

                default:

                    log.Error("There has been an unexpected bonus passed to CheckForBonus: " + bonus);
                    ChatUtil.SendErrorMessage(m_searchPlayer, "Unhandled bonus type (" + bonus + ") specified in search!");
                    m_searchHasError = true;
                    break;
                }
            }

            return(false);
        }
Esempio n. 12
0
        protected virtual bool CheckForSkill(InventoryItem item, int skill)
        {
            if (skill > 0)
            {
                switch (skill)
                {
                case 1: return(CheckForProperty(item, (int)eProperty.Skill_Slashing));

                case 2: return(CheckForProperty(item, (int)eProperty.Skill_Thrusting));

                case 8: return(CheckForProperty(item, (int)eProperty.Skill_Parry));

                case 14: return(CheckForProperty(item, (int)eProperty.Skill_Sword));

                case 16: return(CheckForProperty(item, (int)eProperty.Skill_Hammer));

                case 17: return(CheckForProperty(item, (int)eProperty.Skill_Axe));

                case 18: return(CheckForProperty(item, (int)eProperty.Skill_Left_Axe));

                case 19: return(CheckForProperty(item, (int)eProperty.Skill_Stealth));

                case 26: return(CheckForProperty(item, (int)eProperty.Skill_Spear));

                case 29: return(CheckForProperty(item, (int)eProperty.Skill_Mending));

                case 30: return(CheckForProperty(item, (int)eProperty.Skill_Augmentation));

                case 33: return(CheckForProperty(item, (int)eProperty.Skill_Crushing));

                case 34: return(CheckForProperty(item, (int)eProperty.Skill_Pacification));

                case 37: return(CheckForProperty(item, (int)eProperty.Skill_Subterranean));                        // this is cave magic

                case 38: return(CheckForProperty(item, (int)eProperty.Skill_Darkness));

                case 39: return(CheckForProperty(item, (int)eProperty.Skill_Suppression));

                case 42: return(CheckForProperty(item, (int)eProperty.Skill_Runecarving));

                case 43: return(CheckForProperty(item, (int)eProperty.Skill_Shields));

                case 46: return(CheckForProperty(item, (int)eProperty.Skill_Flexible_Weapon));

                case 47: return(CheckForProperty(item, (int)eProperty.Skill_Staff));

                case 48: return(CheckForProperty(item, (int)eProperty.Skill_Summoning));

                case 50: return(CheckForProperty(item, (int)eProperty.Skill_Stormcalling));

                case 62: return(CheckForProperty(item, (int)eProperty.Skill_BeastCraft));

                case 64: return(CheckForProperty(item, (int)eProperty.Skill_Polearms));

                case 65: return(CheckForProperty(item, (int)eProperty.Skill_Two_Handed));

                case 66: return(CheckForProperty(item, (int)eProperty.Skill_Fire));

                case 67: return(CheckForProperty(item, (int)eProperty.Skill_Wind));

                case 68: return(CheckForProperty(item, (int)eProperty.Skill_Cold));

                case 69: return(CheckForProperty(item, (int)eProperty.Skill_Earth));

                case 70: return(CheckForProperty(item, (int)eProperty.Skill_Light));

                case 71: return(CheckForProperty(item, (int)eProperty.Skill_Matter));

                case 72: return(CheckForProperty(item, (int)eProperty.Skill_Body));

                case 73: return(CheckForProperty(item, (int)eProperty.Skill_Spirit));

                case 74: return(CheckForProperty(item, (int)eProperty.Skill_Mind));

                case 75: return(CheckForProperty(item, (int)eProperty.Skill_Void));

                case 76: return(CheckForProperty(item, (int)eProperty.Skill_Mana));

                case 77: return(CheckForProperty(item, (int)eProperty.Skill_Dual_Wield));

                case 78: return(CheckForProperty(item, (int)eProperty.Skill_Archery));                        // was composite bow

                case 82: return(CheckForProperty(item, (int)eProperty.Skill_Battlesongs));

                case 83: return(CheckForProperty(item, (int)eProperty.Skill_Enhancement));

                case 84: return(CheckForProperty(item, (int)eProperty.Skill_Enchantments));

                case 88: return(CheckForProperty(item, (int)eProperty.Skill_Rejuvenation));

                case 89: return(CheckForProperty(item, (int)eProperty.Skill_Smiting));

                case 90: return(CheckForProperty(item, (int)eProperty.Skill_Long_bows) ||
                                CheckForProperty(item, (int)eProperty.Skill_Composite) ||
                                CheckForProperty(item, (int)eProperty.Skill_RecurvedBow));                                        //  archery?

                case 91: return(CheckForProperty(item, (int)eProperty.Skill_Cross_Bows));

                case 97: return(CheckForProperty(item, (int)eProperty.Skill_Chants));                        // chants?

                case 98: return(CheckForProperty(item, (int)eProperty.Skill_Instruments));

                case 101: return(CheckForProperty(item, (int)eProperty.Skill_Blades));

                case 102: return(CheckForProperty(item, (int)eProperty.Skill_Blunt));

                case 103: return(CheckForProperty(item, (int)eProperty.Skill_Piercing));

                case 104: return(CheckForProperty(item, (int)eProperty.Skill_Large_Weapon));

                case 105: return(CheckForProperty(item, (int)eProperty.Skill_Mentalism));

                case 106: return(CheckForProperty(item, (int)eProperty.Skill_Regrowth));

                case 107: return(CheckForProperty(item, (int)eProperty.Skill_Nurture));

                case 108: return(CheckForProperty(item, (int)eProperty.Skill_Nature));

                case 109: return(CheckForProperty(item, (int)eProperty.Skill_Music));

                case 110: return(CheckForProperty(item, (int)eProperty.Skill_Celtic_Dual));

                case 112: return(CheckForProperty(item, (int)eProperty.Skill_Celtic_Spear));

                case 113: return(CheckForProperty(item, (int)eProperty.Skill_Archery));                        // was recurve bow

                case 114: return(CheckForProperty(item, (int)eProperty.Skill_Valor));

                case 116: return(CheckForProperty(item, (int)eProperty.Skill_Pathfinding));

                case 117: return(CheckForProperty(item, (int)eProperty.Skill_Envenom));

                case 118: return(CheckForProperty(item, (int)eProperty.Skill_Critical_Strike));

                case 120: return(CheckForProperty(item, (int)eProperty.Skill_DeathSight));

                case 121: return(CheckForProperty(item, (int)eProperty.Skill_Pain_working));

                case 122: return(CheckForProperty(item, (int)eProperty.Skill_Death_Servant));

                case 123: return(CheckForProperty(item, (int)eProperty.Skill_SoulRending));

                case 124: return(CheckForProperty(item, (int)eProperty.Skill_HandToHand));

                case 125: return(CheckForProperty(item, (int)eProperty.Skill_Scythe));

                case 126: return(CheckForProperty(item, (int)eProperty.Skill_BoneArmy));

                case 127: return(CheckForProperty(item, (int)eProperty.Skill_Arboreal));

                case 129: return(CheckForProperty(item, (int)eProperty.Skill_Creeping));

                case 130: return(CheckForProperty(item, (int)eProperty.Skill_Verdant));

                case 133: return(CheckForProperty(item, (int)eProperty.Skill_OdinsWill));

                case 134: return(CheckForProperty(item, (int)eProperty.Skill_SpectralGuard) || CheckForProperty(item, (int)eProperty.Skill_SpectralForce));

                case 135: return(CheckForProperty(item, (int)eProperty.Skill_PhantasmalWail));

                case 136: return(CheckForProperty(item, (int)eProperty.Skill_EtherealShriek));

                case 137: return(CheckForProperty(item, (int)eProperty.Skill_ShadowMastery));

                case 138: return(CheckForProperty(item, (int)eProperty.Skill_VampiiricEmbrace));

                case 139: return(CheckForProperty(item, (int)eProperty.Skill_Dementia));

                case 140: return(CheckForProperty(item, (int)eProperty.Skill_Witchcraft));

                case 141: return(CheckForProperty(item, (int)eProperty.Skill_Cursing));

                case 142: return(CheckForProperty(item, (int)eProperty.Skill_Hexing));

                case 147: return(CheckForProperty(item, (int)eProperty.Skill_FistWraps));

                case 148: return(CheckForProperty(item, (int)eProperty.Skill_MaulerStaff));

                case 300: return(CheckForProperty(item, (int)eProperty.Skill_Slashing) ||
                                 CheckForProperty(item, (int)eProperty.Skill_Thrusting) ||
                                 CheckForProperty(item, (int)eProperty.Skill_Crushing) ||
                                 CheckForProperty(item, (int)eProperty.Skill_Shields) ||
                                 CheckForProperty(item, (int)eProperty.Skill_Flexible_Weapon) ||
                                 CheckForProperty(item, (int)eProperty.Skill_Staff) ||
                                 CheckForProperty(item, (int)eProperty.Skill_Polearms) ||
                                 CheckForProperty(item, (int)eProperty.Skill_Two_Handed) ||
                                 CheckForProperty(item, (int)eProperty.Skill_Dual_Wield) ||
                                 CheckForProperty(item, (int)eProperty.Skill_Long_bows) ||
                                 CheckForProperty(item, (int)eProperty.Skill_Composite) ||
                                 CheckForProperty(item, (int)eProperty.Skill_RecurvedBow) ||
                                 CheckForProperty(item, (int)eProperty.Skill_Cross_Bows) ||
                                 CheckForProperty(item, (int)eProperty.Skill_FistWraps) ||
                                 CheckForProperty(item, (int)eProperty.Skill_Sword) ||
                                 CheckForProperty(item, (int)eProperty.Skill_Hammer) ||
                                 CheckForProperty(item, (int)eProperty.Skill_Axe) ||
                                 CheckForProperty(item, (int)eProperty.Skill_Left_Axe) ||
                                 CheckForProperty(item, (int)eProperty.Skill_Spear) ||
                                 CheckForProperty(item, (int)eProperty.Skill_Archery) ||
                                 CheckForProperty(item, (int)eProperty.Skill_Blades) ||
                                 CheckForProperty(item, (int)eProperty.Skill_Blunt) ||
                                 CheckForProperty(item, (int)eProperty.Skill_Piercing) ||
                                 CheckForProperty(item, (int)eProperty.Skill_Large_Weapon) ||
                                 CheckForProperty(item, (int)eProperty.Skill_Celtic_Dual) ||
                                 CheckForProperty(item, (int)eProperty.Skill_Celtic_Spear) ||
                                 CheckForProperty(item, (int)eProperty.Skill_Critical_Strike) ||
                                 CheckForProperty(item, (int)eProperty.Skill_HandToHand) ||
                                 CheckForProperty(item, (int)eProperty.Skill_Archery) ||
                                 CheckForProperty(item, (int)eProperty.Skill_Scythe) ||
                                 CheckForProperty(item, (int)eProperty.AllMeleeWeaponSkills) ||
                                 CheckForProperty(item, (int)eProperty.AllDualWieldingSkills) ||
                                 CheckForProperty(item, (int)eProperty.AllArcherySkills) ||
                                 CheckForProperty(item, (int)eProperty.Skill_MaulerStaff));

                case 303: return(CheckForProperty(item, (int)eProperty.Skill_Fire) ||
                                 CheckForProperty(item, (int)eProperty.Skill_Wind) ||
                                 CheckForProperty(item, (int)eProperty.Skill_Cold) ||
                                 CheckForProperty(item, (int)eProperty.Skill_Earth) ||
                                 CheckForProperty(item, (int)eProperty.Skill_Matter) ||
                                 CheckForProperty(item, (int)eProperty.Skill_Body) ||
                                 CheckForProperty(item, (int)eProperty.Skill_Spirit) ||
                                 CheckForProperty(item, (int)eProperty.Skill_Mind) ||
                                 CheckForProperty(item, (int)eProperty.Skill_Enhancement) ||
                                 CheckForProperty(item, (int)eProperty.Skill_Rejuvenation) ||
                                 CheckForProperty(item, (int)eProperty.Skill_Smiting) ||
                                 CheckForProperty(item, (int)eProperty.Skill_Chants) ||
                                 CheckForProperty(item, (int)eProperty.Skill_DeathSight) ||
                                 CheckForProperty(item, (int)eProperty.Skill_Pain_working) ||
                                 CheckForProperty(item, (int)eProperty.Skill_Death_Servant) ||
                                 CheckForProperty(item, (int)eProperty.Skill_SoulRending) ||
                                 CheckForProperty(item, (int)eProperty.Skill_Mending) ||
                                 CheckForProperty(item, (int)eProperty.Skill_Augmentation) ||
                                 CheckForProperty(item, (int)eProperty.Skill_Pacification) ||
                                 CheckForProperty(item, (int)eProperty.Skill_Subterranean) ||
                                 CheckForProperty(item, (int)eProperty.Skill_Darkness) ||
                                 CheckForProperty(item, (int)eProperty.Skill_Suppression) ||
                                 CheckForProperty(item, (int)eProperty.Skill_Runecarving) ||
                                 CheckForProperty(item, (int)eProperty.Skill_Summoning) ||
                                 CheckForProperty(item, (int)eProperty.Skill_Stormcalling) ||
                                 CheckForProperty(item, (int)eProperty.Skill_BeastCraft) ||
                                 CheckForProperty(item, (int)eProperty.Skill_Light) ||
                                 CheckForProperty(item, (int)eProperty.Skill_Void) ||
                                 CheckForProperty(item, (int)eProperty.Skill_Mana) ||
                                 CheckForProperty(item, (int)eProperty.Skill_Mentalism) ||
                                 CheckForProperty(item, (int)eProperty.Skill_Regrowth) ||
                                 CheckForProperty(item, (int)eProperty.Skill_Nurture) ||
                                 CheckForProperty(item, (int)eProperty.Skill_Nature) ||
                                 CheckForProperty(item, (int)eProperty.Skill_Music) ||
                                 CheckForProperty(item, (int)eProperty.Skill_Valor) ||
                                 CheckForProperty(item, (int)eProperty.Skill_Pathfinding) ||
                                 CheckForProperty(item, (int)eProperty.Skill_Envenom) ||
                                 CheckForProperty(item, (int)eProperty.Skill_BoneArmy) ||
                                 CheckForProperty(item, (int)eProperty.Skill_Arboreal) ||
                                 CheckForProperty(item, (int)eProperty.Skill_Creeping) ||
                                 CheckForProperty(item, (int)eProperty.Skill_Verdant) ||
                                 CheckForProperty(item, (int)eProperty.Skill_OdinsWill) ||
                                 CheckForProperty(item, (int)eProperty.Skill_SpectralGuard) ||
                                 CheckForProperty(item, (int)eProperty.Skill_SpectralForce) ||
                                 CheckForProperty(item, (int)eProperty.Skill_PhantasmalWail) ||
                                 CheckForProperty(item, (int)eProperty.Skill_EtherealShriek) ||
                                 CheckForProperty(item, (int)eProperty.Skill_ShadowMastery) ||
                                 CheckForProperty(item, (int)eProperty.Skill_VampiiricEmbrace) ||
                                 CheckForProperty(item, (int)eProperty.Skill_Dementia) ||
                                 CheckForProperty(item, (int)eProperty.Skill_Witchcraft) ||
                                 CheckForProperty(item, (int)eProperty.Skill_Cursing) ||
                                 CheckForProperty(item, (int)eProperty.Skill_Hexing) ||
                                 CheckForProperty(item, (int)eProperty.AllMagicSkills));

                default:

                    log.Error("There has been an unexpected skill passed to CheckForSkill: " + skill);
                    ChatUtil.SendErrorMessage(m_searchPlayer, "Unhandled skill (" + skill + ") specified in search!");
                    m_searchHasError = true;
                    break;
                }
            }

            return(false);
        }
Esempio n. 13
0
        protected virtual void BuyItem(GamePlayer player, bool usingMarketExplorer = false)
        {
            eInventorySlot fromClientSlot = player.TempProperties.getProperty <eInventorySlot>(CONSIGNMENT_BUY_ITEM, eInventorySlot.Invalid);

            player.TempProperties.removeProperty(CONSIGNMENT_BUY_ITEM);

            InventoryItem item = null;

            lock (LockObject())
            {
                if (fromClientSlot != eInventorySlot.Invalid)
                {
                    IDictionary <int, InventoryItem> clientInventory = GetClientInventory(player);

                    if (clientInventory.ContainsKey((int)fromClientSlot))
                    {
                        item = clientInventory[(int)fromClientSlot];
                    }
                }

                if (item == null)
                {
                    ChatUtil.SendErrorMessage(player, "I can't find the item you want to purchase!");
                    log.ErrorFormat("{0}:{1} tried to purchase an item from slot {2} for consignment merchant on lot {3} and the item does not exist.", player.Name, player.Client.Account, (int)fromClientSlot, HouseNumber);

                    return;
                }

                int sellPrice     = item.SellPrice;
                int purchasePrice = sellPrice;

                if (usingMarketExplorer && ServerProperties.Properties.MARKET_FEE_PERCENT > 0)
                {
                    purchasePrice += ((purchasePrice * ServerProperties.Properties.MARKET_FEE_PERCENT) / 100);
                }

                lock (player.Inventory)
                {
                    if (purchasePrice <= 0)
                    {
                        ChatUtil.SendErrorMessage(player, "This item can't be purchased!");
                        log.ErrorFormat("{0}:{1} tried to purchase {2} for consignment merchant on lot {3} and purchasePrice was {4}.", player.Name, player.Client.Account, item.Name, HouseNumber, purchasePrice);
                        return;
                    }

                    if (ServerProperties.Properties.CONSIGNMENT_USE_BP)
                    {
                        if (player.BountyPoints < purchasePrice)
                        {
                            ChatUtil.SendSystemMessage(player, "GameMerchant.OnPlayerBuy.YouNeedBP", purchasePrice);
                            return;
                        }
                    }
                    else
                    {
                        if (player.GetCurrentMoney() < purchasePrice)
                        {
                            ChatUtil.SendSystemMessage(player, "GameMerchant.OnPlayerBuy.YouNeed", Money.GetString(purchasePrice));
                            return;
                        }
                    }

                    eInventorySlot toClientSlot = player.Inventory.FindFirstEmptySlot(eInventorySlot.FirstBackpack, eInventorySlot.LastBackpack);

                    if (toClientSlot == eInventorySlot.Invalid)
                    {
                        ChatUtil.SendSystemMessage(player, "GameMerchant.OnPlayerBuy.NotInventorySpace", null);
                        return;
                    }

                    if (ServerProperties.Properties.CONSIGNMENT_USE_BP)
                    {
                        ChatUtil.SendMerchantMessage(player, "GameMerchant.OnPlayerBuy.BoughtBP", item.GetName(1, false), purchasePrice);
                        player.BountyPoints -= purchasePrice;
                        player.Out.SendUpdatePoints();
                    }
                    else
                    {
                        if (player.RemoveMoney(purchasePrice))
                        {
                            InventoryLogging.LogInventoryAction(player, this, eInventoryActionType.Merchant, purchasePrice);
                            ChatUtil.SendMerchantMessage(player, "GameMerchant.OnPlayerBuy.Bought", item.GetName(1, false), Money.GetString(purchasePrice));
                        }
                        else
                        {
                            return;
                        }
                    }

                    TotalMoney += sellPrice;

                    if (ServerProperties.Properties.MARKET_ENABLE_LOG)
                    {
                        log.DebugFormat("CM: {0}:{1} purchased '{2}' for {3} from consignment merchant on lot {4}.", player.Name, player.Client.Account.Name, item.Name, purchasePrice, HouseNumber);
                    }

                    NotifyObservers(player, this.MoveItemFromObject(player, fromClientSlot, toClientSlot));
                }
            }
        }
Esempio n. 14
0
        /// <summary>
        /// Looks up if a given client have access for the specific command in this guild
        /// </summary>
        /// <returns>true or false</returns>
        public bool HasRank(GamePlayer member, Guild.eRank rankNeeded)
        {
            try
            {
                // Is the player in the guild at all?
                if (!m_onlineGuildPlayers.ContainsKey(member.InternalID))
                {
                    log.Debug("Player " + member.Name + " (" + member.InternalID + ") is not a member of guild " + Name);
                    return(false);
                }

                // If player have a privlevel above 1, it has access enough
                if (member.Client.Account.PrivLevel > 1)
                {
                    return(true);
                }

                if (member.GuildRank == null)
                {
                    if (log.IsWarnEnabled)
                    {
                        log.Warn("Rank not in db for player " + member.Name);
                    }

                    return(false);
                }

                switch (rankNeeded)
                {
                case Guild.eRank.Emblem:
                {
                    return(member.GuildRank.Emblem);
                }

                case Guild.eRank.AcHear:
                {
                    return(member.GuildRank.AcHear);
                }

                case Guild.eRank.AcSpeak:
                {
                    return(member.GuildRank.AcSpeak);
                }

                case Guild.eRank.Demote:
                {
                    return(member.GuildRank.Promote);
                }

                case Guild.eRank.Promote:
                {
                    return(member.GuildRank.Promote);
                }

                case Guild.eRank.GcHear:
                {
                    return(member.GuildRank.GcHear);
                }

                case Guild.eRank.GcSpeak:
                {
                    return(member.GuildRank.GcSpeak);
                }

                case Guild.eRank.Invite:
                {
                    return(member.GuildRank.Invite);
                }

                case Guild.eRank.OcHear:
                {
                    return(member.GuildRank.OcHear);
                }

                case Guild.eRank.OcSpeak:
                {
                    return(member.GuildRank.OcSpeak);
                }

                case Guild.eRank.Remove:
                {
                    return(member.GuildRank.Remove);
                }

                case Guild.eRank.Alli:
                {
                    return(member.GuildRank.Alli);
                }

                case Guild.eRank.View:
                {
                    return(member.GuildRank.View);
                }

                case Guild.eRank.Claim:
                {
                    return(member.GuildRank.Claim);
                }

                case Guild.eRank.Release:
                {
                    return(member.GuildRank.Release);
                }

                case Guild.eRank.Upgrade:
                {
                    return(member.GuildRank.Upgrade);
                }

                case Guild.eRank.Dues:
                {
                    return(member.GuildRank.Dues);
                }

                case Guild.eRank.Withdraw:
                {
                    return(member.GuildRank.Withdraw);
                }

                case Guild.eRank.Leader:
                {
                    return(member.GuildRank.RankLevel == 0);
                }

                case Guild.eRank.Buff:
                {
                    return(member.GuildRank.Buff);
                }

                default:
                {
                    if (log.IsWarnEnabled)
                    {
                        log.Warn("Required rank not in the DB: " + rankNeeded);
                    }

                    ChatUtil.SendDebugMessage(member, "Required rank not in the DB: " + rankNeeded);

                    return(false);
                }
                }
            }
            catch (Exception e)
            {
                if (log.IsErrorEnabled)
                {
                    log.Error("GotAccess", e);
                }

                return(false);
            }
        }