/// <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);
        }
Beispiel #2
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);
        }
Beispiel #3
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);
            }
        }