Beispiel #1
0
        /// <summary>
        /// Create an Item, Search for a NPC to consign the Item and give Item to the Player
        /// </summary>
        /// <param name="player">The GamePlayer Object</param>
        /// <param name="source">The source of the task</param>
        public static bool BuildTask(GamePlayer player, GameLiving source)
        {
            if (source == null)
            {
                return(false);
            }

            GameNPC NPC = GetRandomNPC(player);

            if (NPC == null)
            {
                player.Out.SendMessage("I have no task for you, come back some time later.", eChatType.CT_System, eChatLoc.CL_PopupWindow);
                return(false);
            }

            ItemTemplate taskItem = GenerateNPCItem(player);

            if (taskItem == null)
            {
                player.Out.SendMessage("I can't think of anything for you to make, perhaps you should ask again.", eChatType.CT_System, eChatLoc.CL_PopupWindow);
                log.ErrorFormat("Craft task item is null for player {0} at level {1}.", player.Name, player.Level);
                return(false);
            }

            var craftTask = new CraftTask(player)
            {
                TimeOut      = DateTime.Now.AddHours(2),
                ItemName     = taskItem.Name,
                RecieverName = NPC.Name,
                RecieverZone = NPC.CurrentZone.Description
            };

            craftTask.SetRewardMoney((long)(taskItem.Price * RewardMoneyRatio));

            player.Task = craftTask;

            player.Out.SendMessage("Craft " + taskItem.GetName(0, false) + " for " + NPC.Name + " in " + NPC.CurrentZone.Description, eChatType.CT_Say, eChatLoc.CL_PopupWindow);
            return(true);
        }
Beispiel #2
0
        /// <summary>
        /// Create an Item, Search for a NPC to consign the Item and give Item to the Player
        /// </summary>
        /// <param name="player">The GamePlayer Object</param>
        /// <param name="source">The source of the task</param>
        public static bool BuildTask(GamePlayer player, GameLiving source)
        {
            if (source == null)
                return false;

            GameNPC NPC = GetRandomNPC(player);
            if (NPC == null)
            {
                player.Out.SendMessage("I have no task for you, come back some time later.", eChatType.CT_System, eChatLoc.CL_PopupWindow);
                return false;
            }

            ItemTemplate taskItem = GenerateNPCItem(player);

            if (taskItem == null)
            {
                player.Out.SendMessage("I can't think of anything for you to make, perhaps you should ask again.", eChatType.CT_System, eChatLoc.CL_PopupWindow);
                log.ErrorFormat("Craft task item is null for player {0} at level {1}.", player.Name, player.Level);
                return false;
            }

            var craftTask = new CraftTask(player)
                                {
                                    TimeOut = DateTime.Now.AddHours(2),
                                    ItemName = taskItem.Name,
                                    RecieverName = NPC.Name,
                                    RecieverZone = NPC.CurrentZone.Description
                                };

            craftTask.SetRewardMoney((long)(taskItem.Price * RewardMoneyRatio));

            player.Task = craftTask;

            player.Out.SendMessage("Craft " + taskItem.GetName(0, false) + " for " + NPC.Name + " in " + NPC.CurrentZone.Description, eChatType.CT_Say, eChatLoc.CL_PopupWindow);
            return true;
        }