public void Cmd_UCE_AcceptQuest(int npcQuestIndex)
    {
        if (state == "IDLE" &&
            target != null &&
            isAlive &&
            target.isAlive &&
            target is Npc &&
            0 <= npcQuestIndex && npcQuestIndex < ((Npc)target).UCE_quests.Length &&
            Utils.ClosestDistance(collider, target.collider) <= interactionRange &&
            UCE_CanAcceptQuest(((Npc)target).UCE_quests[npcQuestIndex]))
        {
            int idx = UCE_GetQuestIndexByName(((Npc)target).UCE_quests[npcQuestIndex].name);

            if (idx == -1)
            {
                UCE_ScriptableQuest quest = ((Npc)target).UCE_quests[npcQuestIndex];
                UCE_quests.Add(new UCE_Quest(quest));

                // -- accept items
                if (quest.acceptItems != null && quest.acceptItems.Length > 0)
                {
                    foreach (UCE_rewardItem rewardItem in quest.acceptItems)
                    {
                        InventoryAdd(new Item(rewardItem.item), rewardItem.amount);
                    }
                }
            }
            else
            {
                UCE_Quest quest = UCE_quests[idx];
                quest.resetQuest();
                quest.completedAgain = false;
                quest.lastCompleted  = "";
                UCE_quests[idx]      = quest;

                // -- accept items
                if (quest.acceptItems != null && quest.acceptItems.Length > 0)
                {
                    foreach (UCE_rewardItem rewardItem in quest.acceptItems)
                    {
                        InventoryAdd(new Item(rewardItem.item), rewardItem.amount);
                    }
                }
            }
        }
    }
    // -----------------------------------------------------------------------------------
    // UCE_FinishQuest
    // @Server
    // -----------------------------------------------------------------------------------
    protected void UCE_FinishQuest(int index)
    {
        if (index != -1)
        {
            UCE_Quest quest = UCE_quests[index];

            if (UCE_CanCompleteQuest(quest.name))
            {
                // -- remove accept items (optional)
                if (quest.removeAtCompletion && quest.acceptItems.Length > 0)
                {
                    foreach (UCE_rewardItem rewardItem in quest.acceptItems)
                    {
                        InventoryRemove(new Item(rewardItem.item), rewardItem.amount);
                    }
                }

                // -- remove gathered items
                if (!quest.DontDestroyGathered)
                {
                    foreach (UCE_gatherTarget gatherTarget in quest.gatherTarget)
                    {
                        InventoryRemove(new Item(gatherTarget.target), gatherTarget.amount);
                    }
                }

                // -- determine the correct reward
                if (quest.questRewards.Length > 0)
                {
                    UCE_QuestReward reward = getQuestReward(quest);

                    // -- gain basic rewards
                    gold       += reward.rewardGold;
                    experience += reward.rewardExperience;
                    coins      += reward.rewardCoins;

                    // -- reward items
                    if (reward.rewardItem.Length > 0)
                    {
                        foreach (UCE_rewardItem rewardItem in reward.rewardItem)
                        {
                            InventoryAdd(new Item(rewardItem.item), rewardItem.amount);
                        }
                    }

                    // -- unlock travelroutes
#if _iMMOTRAVEL
                    foreach (UCE_Unlockroute route in reward.rewardUnlockroutes)
                    {
                        UCE_UnlockTravelroute(route);
                    }
#endif

                    // -- reward honor currency
#if _iMMOHONORSHOP
                    foreach (UCE_HonorShopCurrencyCost currency in reward.honorCurrency)
                    {
                        UCE_AddHonorCurrency(currency.honorCurrency, currency.amount);
                    }
#endif

                    // -- apply realm change
#if _iMMOPVP
                    UCE_setRealm(reward.changeRealm, reward.changeAlliedRealm);
#endif
                }

                // -- apply faction modifiers
#if _iMMOFACTIONS
                foreach (UCE_FactionModifier factionModifier in quest.factionModifiers)
                {
                    UCE_AddFactionRating(factionModifier.faction, factionModifier.amount);
                }
#endif

                // -- apply world events
#if _iMMOWORLDEVENTS
                if (quest.worldEvent != null)
                {
                    UCE_ModifyWorldEventCount(quest.worldEvent, quest.worldEventModifier);
                }
#endif

                // -- complete quest
                quest.completed = true;
                quest.counter++;

                if (quest.repeatable > 0)
                {
                    quest.resetQuest();
                    quest.completedAgain = true;
                    quest.lastCompleted  = DateTime.UtcNow.ToString("s");
                }

                UCE_quests[index] = quest;
            }
        }
    }