Set iOpt to 1 for mission rewards and disallow trading iOpt 0 items

Co-authored-by: Jade <jadeshrinemaiden@gmail.com>
This commit is contained in:
dongresource 2021-01-17 22:50:49 +01:00
parent b0697f12a3
commit 74af1ad173
3 changed files with 14 additions and 2 deletions

View File

@ -532,6 +532,11 @@ bool ItemManager::doTrade(Player* plr, Player* plr2) {
if (plrInven[plr->Trade[i].iInvenNum].iID == 0) // pulling a fast one on us if (plrInven[plr->Trade[i].iInvenNum].iID == 0) // pulling a fast one on us
return false; return false;
if (plr->Trade[i].iOpt < 1) {
std::cout << "[WARN] Player tried trading an iOpt < 1 amount" << std::endl;
plr->Trade[i].iOpt = 1;
}
// for stacked items // for stacked items
plrInven[plr->Trade[i].iInvenNum].iOpt -= plr->Trade[i].iOpt; plrInven[plr->Trade[i].iInvenNum].iOpt -= plr->Trade[i].iOpt;
@ -548,6 +553,11 @@ bool ItemManager::doTrade(Player* plr, Player* plr2) {
if (plr2Inven[plr2->Trade[i].iInvenNum].iID == 0) // pulling a fast one on us if (plr2Inven[plr2->Trade[i].iInvenNum].iID == 0) // pulling a fast one on us
return false; return false;
if (plr2->Trade[i].iOpt < 1) {
std::cout << "[WARN] Player tried trading an iOpt < 1 amount" << std::endl;
plr2->Trade[i].iOpt = 1;
}
// for stacked items // for stacked items
plr2Inven[plr2->Trade[i].iInvenNum].iOpt -= plr2->Trade[i].iOpt; plr2Inven[plr2->Trade[i].iInvenNum].iOpt -= plr2->Trade[i].iOpt;

View File

@ -442,6 +442,7 @@ int MissionManager::giveMissionReward(CNSocket *sock, int task, int choice) {
for (int i = 0; i < nrewards; i++) { for (int i = 0; i < nrewards; i++) {
item[i].sItem.iType = reward->itemTypes[offset+i]; item[i].sItem.iType = reward->itemTypes[offset+i];
item[i].sItem.iID = reward->itemIds[offset+i]; item[i].sItem.iID = reward->itemIds[offset+i];
item[i].sItem.iOpt = 1;
item[i].iSlotNum = slots[i]; item[i].iSlotNum = slots[i];
item[i].eIL = 1; item[i].eIL = 1;

View File

@ -142,9 +142,10 @@ void NPCManager::npcVendorBuy(CNSocket* sock, CNPacketData* data) {
return; return;
} }
// if vehicle // if vehicle
if (req->Item.iType == 10) if (req->Item.iType == 10) {
// set time limit: current time + 7days // set time limit: current time + 7days
req->Item.iTimeLimit = getTimestamp() + 604800; req->Item.iTimeLimit = getTimestamp() + 604800;
}
if (slot != req->iInvenSlotNum) { if (slot != req->iInvenSlotNum) {
// possible item stacking? // possible item stacking?
@ -921,7 +922,7 @@ static void lordFuseStageThree(CNSocket *sock, BaseNPC *npc) {
std::cout << "Lord Fuse stage three" << std::endl; std::cout << "Lord Fuse stage three" << std::endl;
// Cosmic, Damage Point // Cosmix, Damage Point
Mob *newbody = (Mob*)NPCManager::summonNPC(oldbody->spawnX, oldbody->spawnY, oldbody->spawnZ, plr->instanceID, 2468); Mob *newbody = (Mob*)NPCManager::summonNPC(oldbody->spawnX, oldbody->spawnY, oldbody->spawnZ, plr->instanceID, 2468);
newbody->appearanceData.iAngle = oldbody->appearanceData.iAngle; newbody->appearanceData.iAngle = oldbody->appearanceData.iAngle;