Scripts/Commands: Fix .quest complete to properly work with PvP kill quests
Port From (https://github.com/TrinityCore/TrinityCore/commit/8a309542ce73cd53382bef574ecce6cbfd421615)
This commit is contained in:
@@ -99,58 +99,64 @@ namespace Game.Chat
|
|||||||
switch (obj.Type)
|
switch (obj.Type)
|
||||||
{
|
{
|
||||||
case QuestObjectiveType.Item:
|
case QuestObjectiveType.Item:
|
||||||
|
{
|
||||||
|
uint curItemCount = player.GetItemCount((uint)obj.ObjectID, true);
|
||||||
|
List<ItemPosCount> dest = new();
|
||||||
|
InventoryResult msg = player.CanStoreNewItem(ItemConst.NullBag, ItemConst.NullSlot, dest, (uint)obj.ObjectID, (uint)(obj.Amount - curItemCount));
|
||||||
|
if (msg == InventoryResult.Ok)
|
||||||
{
|
{
|
||||||
uint curItemCount = player.GetItemCount((uint)obj.ObjectID, true);
|
Item item = player.StoreNewItem(dest, (uint)obj.ObjectID, true);
|
||||||
List<ItemPosCount> dest = new();
|
player.SendNewItem(item, (uint)(obj.Amount - curItemCount), true, false);
|
||||||
InventoryResult msg = player.CanStoreNewItem(ItemConst.NullBag, ItemConst.NullSlot, dest, (uint)obj.ObjectID, (uint)(obj.Amount - curItemCount));
|
|
||||||
if (msg == InventoryResult.Ok)
|
|
||||||
{
|
|
||||||
Item item = player.StoreNewItem(dest, (uint)obj.ObjectID, true);
|
|
||||||
player.SendNewItem(item, (uint)(obj.Amount - curItemCount), true, false);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
case QuestObjectiveType.Monster:
|
case QuestObjectiveType.Monster:
|
||||||
{
|
{
|
||||||
CreatureTemplate creatureInfo = Global.ObjectMgr.GetCreatureTemplate((uint)obj.ObjectID);
|
CreatureTemplate creatureInfo = Global.ObjectMgr.GetCreatureTemplate((uint)obj.ObjectID);
|
||||||
if (creatureInfo != null)
|
if (creatureInfo != null)
|
||||||
for (int z = 0; z < obj.Amount; ++z)
|
|
||||||
player.KilledMonster(creatureInfo, ObjectGuid.Empty);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case QuestObjectiveType.GameObject:
|
|
||||||
{
|
|
||||||
for (int z = 0; z < obj.Amount; ++z)
|
for (int z = 0; z < obj.Amount; ++z)
|
||||||
player.KillCreditGO((uint)obj.ObjectID);
|
player.KilledMonster(creatureInfo, ObjectGuid.Empty);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case QuestObjectiveType.GameObject:
|
||||||
|
{
|
||||||
|
for (int z = 0; z < obj.Amount; ++z)
|
||||||
|
player.KillCreditGO((uint)obj.ObjectID);
|
||||||
|
break;
|
||||||
|
}
|
||||||
case QuestObjectiveType.MinReputation:
|
case QuestObjectiveType.MinReputation:
|
||||||
|
{
|
||||||
|
int curRep = player.GetReputationMgr().GetReputation((uint)obj.ObjectID);
|
||||||
|
if (curRep < obj.Amount)
|
||||||
{
|
{
|
||||||
int curRep = player.GetReputationMgr().GetReputation((uint)obj.ObjectID);
|
FactionRecord factionEntry = CliDB.FactionStorage.LookupByKey(obj.ObjectID);
|
||||||
if (curRep < obj.Amount)
|
if (factionEntry != null)
|
||||||
{
|
player.GetReputationMgr().SetReputation(factionEntry, obj.Amount);
|
||||||
FactionRecord factionEntry = CliDB.FactionStorage.LookupByKey(obj.ObjectID);
|
|
||||||
if (factionEntry != null)
|
|
||||||
player.GetReputationMgr().SetReputation(factionEntry, obj.Amount);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
case QuestObjectiveType.MaxReputation:
|
case QuestObjectiveType.MaxReputation:
|
||||||
|
{
|
||||||
|
int curRep = player.GetReputationMgr().GetReputation((uint)obj.ObjectID);
|
||||||
|
if (curRep > obj.Amount)
|
||||||
{
|
{
|
||||||
int curRep = player.GetReputationMgr().GetReputation((uint)obj.ObjectID);
|
FactionRecord factionEntry = CliDB.FactionStorage.LookupByKey(obj.ObjectID);
|
||||||
if (curRep > obj.Amount)
|
if (factionEntry != null)
|
||||||
{
|
player.GetReputationMgr().SetReputation(factionEntry, obj.Amount);
|
||||||
FactionRecord factionEntry = CliDB.FactionStorage.LookupByKey(obj.ObjectID);
|
|
||||||
if (factionEntry != null)
|
|
||||||
player.GetReputationMgr().SetReputation(factionEntry, obj.Amount);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
case QuestObjectiveType.Money:
|
case QuestObjectiveType.Money:
|
||||||
{
|
{
|
||||||
player.ModifyMoney(obj.Amount);
|
player.ModifyMoney(obj.Amount);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case QuestObjectiveType.PlayerKills:
|
||||||
|
{
|
||||||
|
for (var z = 0; z < obj.Amount; ++z)
|
||||||
|
player.KilledPlayerCredit(ObjectGuid.Empty);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user