Esempio n. 1
0
        //public bool InitTavernTaskManager(List<CSCommon.Data.Task.TavernTaskData> tasks, List<CSCommon.Data.ItemData> items)
        //{
        //    if (mIsInited == true)
        //        return false;

        //    mTasks.Clear();
        //    foreach (var i in tasks)
        //    {
        //        var taskInstance = new TaverTaskInstance();
        //        taskInstance.InitTask(i);
        //        mTasks.Add(i.TaskId, taskInstance);
        //    }
        //    mAllRewardItems.Clear();
        //    foreach (var i in items)
        //    {
        //        if (i.Inventory != (byte)CSCommon.eItemInventory.TavernTaskReward)
        //        {
        //            System.Diagnostics.Debugger.Break();
        //        }

        //        var item = Inventory.Item.DangerousCreateItem(i);
        //        mAllRewardItems.Add(i.ItemId,item);
        //    }
        //    return true;
        //}

        public CSCommon.Data.Task.TavernTaskData IssueTask(ulong planesId, ulong playerId, string planesName, string killPlayer, List <ulong> itemRewards, int payRMB, int payMoney)
        {
            var taskData = new CSCommon.Data.Task.TavernTaskData();

            taskData.TaskId        = ServerFrame.Util.GenerateObjID(ServerFrame.GameObjectType.Task);
            taskData.PlanesId      = planesId;
            taskData.IssuePlayerId = playerId;
            taskData.IssueTime     = System.DateTime.Now;
            taskData.PlanesName    = planesName;
            taskData.KillPlayer    = killPlayer;
            taskData.PayRMB        = payRMB;
            taskData.PayMoney      = payMoney;
            var task = new TaverTaskInstance();

            task.InitTask(taskData);
            //if (player.PlayerData.RoleDetail.RolePrivateRmb < (ulong)payMoney)
            //    return null;
            //player.PlayerData.RoleDetail.RolePrivateRmb -= (ulong)payMoney;

            //foreach (var i in itemRewards)
            //{
            //    var item = player.ItemBag.RemoveItem(i);
            //    if (item!=null)
            //    {
            //        mAllRewardItems[i] = item;
            //        item.ItemData.Inventory = (byte)CSCommon.eItemInventory.TavernTaskReward;
            //        taskData.ItemRewards += i.ToString() + ';';
            //    }
            //}
            mTasks[taskData.TaskId] = task;
            return(taskData);
        }
Esempio n. 2
0
 public void InitTask(CSCommon.Data.Task.TavernTaskData data)
 {
     mTaskData = data;
 }