diff --git a/.vscode/tasks.json b/.vscode/tasks.json index 1c6e5c871..a955aa60c 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -6,7 +6,7 @@ { "label": "make", "type": "shell", - "command": "cd build && make", + "command": "cd bin && make", "group": { "kind": "build", "isDefault": true @@ -18,7 +18,7 @@ { "label": "make clean", "type": "shell", - "command": "cd build && make clean", + "command": "cd bin && make clean", "group": { "kind": "build", "isDefault": true @@ -30,7 +30,7 @@ { "label": "cmake", "type": "shell", - "command": "mkdir -p build && cd build && rm CMakeCache.txt && cmake -DEQEMU_BUILD_LOGIN=ON -DEQEMU_BUILD_LUA=ON -G 'Unix Makefiles' ..", + "command": "mkdir -p bin && cd bin && rm CMakeCache.txt && cmake -DEQEMU_BUILD_LOGIN=ON -DEQEMU_BUILD_LUA=ON -G 'Unix Makefiles' ..", "group": { "kind": "build", "isDefault": true @@ -52,7 +52,7 @@ { "label": "download maps", "type": "shell", - "command": "mkdir -p build/bin && cd build/bin && wget https://codeload.github.com/Akkadius/EQEmuMaps/zip/master -O maps.zip && unzip -o maps.zip && rm ./maps -rf && mv EQEmuMaps-master maps && rm maps.zip", + "command": "mkdir -p bin && cd bin && wget https://codeload.github.com/Akkadius/EQEmuMaps/zip/master -O maps.zip && unzip -o maps.zip && rm ./maps -rf && mv EQEmuMaps-master maps && rm maps.zip", "group": { "kind": "build", "isDefault": true @@ -64,7 +64,7 @@ { "label": "download quests", "type": "shell", - "command": "mkdir -p build/bin && cd build/bin && cd server && git -C ./quests pull 2> /dev/null || git clone https://github.com/ProjectEQ/projecteqquests.git quests", + "command": "mkdir -p bin && cd bin && cd server && git -C ./quests pull 2> /dev/null || git clone https://github.com/ProjectEQ/projecteqquests.git quests", "group": { "kind": "build", "isDefault": true @@ -76,7 +76,7 @@ { "label": "download eqemu_config", "type": "shell", - "command": "mkdir -p build/bin && cd build/bin && wget --no-check-certificate https://raw.githubusercontent.com/Akkadius/EQEmuInstall/master/eqemu_config_docker.json -O eqemu_config.json", + "command": "mkdir -p bin && cd bin && wget --no-check-certificate https://raw.githubusercontent.com/Akkadius/EQEmuInstall/master/eqemu_config_docker.json -O eqemu_config.json", "group": { "kind": "build", "isDefault": true @@ -88,7 +88,7 @@ { "label": "rebuild database (mariadb must be started)", "type": "shell", - "command": "mkdir -p build/bin && cd build/bin && docker run -i --rm --privileged -v ${HOST_PROJECT_PATH}/build/bin:/src --network=eqemu -it eqemu/server:0.0.3 bash -c './eqemu_server.pl source_peq_db && ./eqemu_server.pl check_db_updates && ./eqemu_server.pl linux_login_server_setup'", + "command": "mkdir -p bin && cd bin && docker run -i --rm --privileged -v ${HOST_PROJECT_PATH}/bin:/src --network=eqemu -it eqemu/server:0.0.3 bash -c './eqemu_server.pl source_peq_db && ./eqemu_server.pl check_db_updates && ./eqemu_server.pl linux_login_server_setup'", "group": { "kind": "build", "isDefault": true @@ -100,7 +100,7 @@ { "label": "zone 7000", "type": "shell", - "command": "docker stop zone7000 | true && docker network create eqemu | true && docker run -i --rm --name zone7000 --cap-add=SYS_PTRACE --security-opt seccomp=unconfined --privileged -v ${HOST_PROJECT_PATH}/build/bin:/src --ulimit core=10000000 --network=eqemu -p 7000:7000/udp -e LD_LIBRARY_PATH=/src/ eqemu/server:0.0.3 gdb -ex run --args ./zone dynamic_zone7000:7000", + "command": "docker stop zone7000 | true && docker network create eqemu | true && docker run -i --rm --name zone7000 --cap-add=SYS_PTRACE --security-opt seccomp=unconfined --privileged -v ${HOST_PROJECT_PATH}/bin:/src --ulimit core=10000000 --network=eqemu -p 7000:7000/udp -e LD_LIBRARY_PATH=/src/ eqemu/server:0.0.3 gdb -ex run --args ./zone dynamic_zone7000:7000", "group": { "kind": "test", "isDefault": true @@ -109,7 +109,7 @@ { "label": "zone 7001", "type": "shell", - "command": "docker stop zone7001 | true && docker network create eqemu | true && docker run -i --rm --name zone7001 --cap-add=SYS_PTRACE --security-opt seccomp=unconfined --privileged -v ${HOST_PROJECT_PATH}/build/bin:/src --ulimit core=10000000 --network=eqemu -p 7001:7001/udp -e LD_LIBRARY_PATH=/src/ eqemu/server:0.0.3 gdb -ex run --args ./zone dynamic_zone7001:7001", + "command": "docker stop zone7001 | true && docker network create eqemu | true && docker run -i --rm --name zone7001 --cap-add=SYS_PTRACE --security-opt seccomp=unconfined --privileged -v ${HOST_PROJECT_PATH}/bin:/src --ulimit core=10000000 --network=eqemu -p 7001:7001/udp -e LD_LIBRARY_PATH=/src/ eqemu/server:0.0.3 gdb -ex run --args ./zone dynamic_zone7001:7001", "group": { "kind": "test", "isDefault": true @@ -118,7 +118,7 @@ { "label": "loginserver", "type": "shell", - "command": "docker stop loginserver | true && docker network create eqemu | true && docker run -i --rm --cap-add=SYS_PTRACE --security-opt seccomp=unconfined --privileged -v ${HOST_PROJECT_PATH}/build/bin:/src --ulimit core=10000000 --network=eqemu --name loginserver -p 5999:5999/udp -p 5998:5998/udp -e LD_LIBRARY_PATH=/src/ eqemu/server:0.0.3 gdb -ex run --args ./loginserver", + "command": "docker stop loginserver | true && docker network create eqemu | true && docker run -i --rm --cap-add=SYS_PTRACE --security-opt seccomp=unconfined --privileged -v ${HOST_PROJECT_PATH}/bin:/src --ulimit core=10000000 --network=eqemu --name loginserver -p 5999:5999/udp -p 5998:5998/udp -e LD_LIBRARY_PATH=/src/ eqemu/server:0.0.3 gdb -ex run --args ./loginserver", "group": { "kind": "test", "isDefault": true @@ -127,7 +127,7 @@ { "label": "shared_memory, world", "type": "shell", - "command": "docker stop sharedmemory | true && docker stop world | true && docker network create eqemu | true && docker run --rm -v ${HOST_PROJECT_PATH}/build/bin:/src --network=eqemu --name sharedmemory eqemu/server:0.0.3 ./shared_memory && docker run --rm -v ${HOST_PROJECT_PATH}/build/bin:/src --ulimit core=10000000 -e LD_LIBRARY_PATH=/src/ --network=eqemu --name world -p 9000:9000 -p 9000:9000/udp -p 9001:9001 -p 9080:9080 eqemu/server:0.0.3 gdb -ex run ./world", + "command": "docker stop sharedmemory | true && docker stop world | true && docker network create eqemu | true && docker run --rm -v ${HOST_PROJECT_PATH}/bin:/src --network=eqemu --name sharedmemory eqemu/server:0.0.3 ./shared_memory && docker run --rm -v ${HOST_PROJECT_PATH}/bin:/src --ulimit core=10000000 -e LD_LIBRARY_PATH=/src/ --network=eqemu --name world -p 9000:9000 -p 9000:9000/udp -p 9001:9001 -p 9080:9080 eqemu/server:0.0.3 gdb -ex run ./world", "group": { "kind": "test", "isDefault": true @@ -136,7 +136,7 @@ { "label": "queryserv", "type": "shell", - "command": "docker stop queryserv | true && docker run --rm -v ${HOST_PROJECT_PATH}/build/bin:/src --ulimit core=10000000 -e LD_LIBRARY_PATH=/src/ --network=eqemu --name queryserv eqemu/server:0.0.3 gdb -ex run ./queryserv", + "command": "docker stop queryserv | true && docker run --rm -v ${HOST_PROJECT_PATH}/bin:/src --ulimit core=10000000 -e LD_LIBRARY_PATH=/src/ --network=eqemu --name queryserv eqemu/server:0.0.3 gdb -ex run ./queryserv", "group": { "kind": "test", "isDefault": true @@ -145,7 +145,16 @@ { "label": "mariadb", "type": "shell", - "command": "docker stop mariadb | true && cd build/bin && docker network create eqemu | true && docker run --rm -v ${HOST_PROJECT_PATH}/build/bin/db:/bitnami/mariadb -p 3306:3306 -e MARIADB_DATABASE=peq -e MARIADB_USER=eqemu -e MARIADB_PASSWORD=eqemupass -e ALLOW_EMPTY_PASSWORD=yes --name mariadb --network=eqemu bitnami/mariadb:latest", + "command": "docker stop mariadb | true && cd bin && docker network create eqemu | true && docker run --rm -v ${HOST_PROJECT_PATH}/bin/db:/bitnami/mariadb -p 3306:3306 -e MARIADB_DATABASE=peq -e MARIADB_USER=eqemu -e MARIADB_PASSWORD=eqemupass -e ALLOW_EMPTY_PASSWORD=yes --name mariadb --network=eqemu bitnami/mariadb:latest", + "group": { + "kind": "test", + "isDefault": true + } + }, + { + "label": "ucs", + "type": "shell", + "command": "docker stop ucs | true && cd bin && docker network create eqemu | true && docker run --rm -v ${HOST_PROJECT_PATH}/bin:/src -p 7778:7778 --name ucs --network=eqemu eqemu/server:0.0.3 gdb -ex run ./ucs", "group": { "kind": "test", "isDefault": true diff --git a/common/ruletypes.h b/common/ruletypes.h index d31d27e8e..016fefc7d 100644 --- a/common/ruletypes.h +++ b/common/ruletypes.h @@ -52,6 +52,7 @@ RULE_BOOL(Character, LeaveCorpses, true, "Setting whether you leave a corpse beh RULE_BOOL(Character, LeaveNakedCorpses, false, "Setting whether you leave a corpse without items") RULE_INT(Character, MaxDraggedCorpses, 2, "Maximum number of corpses you can drag at once") RULE_REAL(Character, DragCorpseDistance, 400, "If a player is using /corpsedrag and moving, the corpse will not move until the player exceeds this distance") +RULE_REAL(Character, FinalExpMultiplier, 1, "Added on top of everything else, easy for setting EXP events") RULE_REAL(Character, ExpMultiplier, 0.5, "If greater than 0, the experience gained is multiplied by this value. ") RULE_REAL(Character, AAExpMultiplier, 0.5, "If greater than 0, the AA experience gained is multiplied by this value. ") RULE_REAL(Character, GroupExpMultiplier, 0.5, "The experience in a group is multiplied by this value in addition to the group multiplier. The group multiplier is: 2 members=x 1.2, 3=x1.4, 4=x1.6, 5=x1.8, 6=x2.16") diff --git a/world/main.cpp b/world/main.cpp index 49e02859f..b94ecea4c 100644 --- a/world/main.cpp +++ b/world/main.cpp @@ -344,9 +344,6 @@ int main(int argc, char** argv) { database.ClearInvSnapshots(); LogInfo("Loading items"); - LogInfo("Purging player sold merchant items"); - MerchantlistTempRepository::Truncate(); - if (!content_db.LoadItems(hotfix_name)) { LogError("Error: Could not load item data. But ignoring"); } diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index 19773f3a4..47066a5aa 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -14246,12 +14246,19 @@ void Client::Handle_OP_TradeRequest(const EQApplicationPacket *app) // Client requesting a trade session from an npc/client // Trade session not started until OP_TradeRequestAck is sent - CommonBreakInvisible(); - - // Pass trade request on to recipient TradeRequest_Struct* msg = (TradeRequest_Struct*)app->pBuffer; Mob* tradee = entity_list.GetMob(msg->to_mob_id); + // If the tradee is an untargettable mob - ignore + // Helps in cases where servers use invisible_man, body type 11 for quests + // and the client opens a trade by mistake. + if (tradee && (tradee->GetBodyType() == 11)) { + return; + } + + CommonBreakInvisible(); + + // Pass trade request on to recipient if (tradee && tradee->IsClient()) { tradee->CastToClient()->QueuePacket(app); } diff --git a/zone/command.cpp b/zone/command.cpp index 0a240f33b..9b42adacd 100755 --- a/zone/command.cpp +++ b/zone/command.cpp @@ -9966,7 +9966,7 @@ void command_task(Client *c, const Seperator *sep) { if(!strcasecmp(sep->arg[2], "task") && (sep->arg[3][0] != '\0')) { int TaskID = atoi(sep->arg[3]); if((TaskID > 0) && (TaskID < MAXTASKS)) { - c->Message(Chat::Yellow, "Sending reload task %i to world"); + c->Message(Chat::Yellow, "Sending reload task %i to world", TaskID); worldserver.SendReloadTasks(RELOADTASKS, TaskID); c->Message(Chat::Yellow, "Back again"); return; diff --git a/zone/corpse.cpp b/zone/corpse.cpp index cfcfb0397..e0e1d1992 100644 --- a/zone/corpse.cpp +++ b/zone/corpse.cpp @@ -621,7 +621,7 @@ bool Corpse::Save() { end = itemlist.end(); for (; cur != end; ++cur) { ServerLootItem_Struct* item = *cur; - memcpy((char*)&dbpc->items[x++], (char*)item, sizeof(ServerLootItem_Struct)); + memcpy((char*)&dbpc->items[x++], (char*)item, sizeof(player_lootitem::ServerLootItem_Struct)); } /* Create New Corpse*/ @@ -1573,10 +1573,10 @@ void Corpse::UpdateEquipmentLight() for (auto iter = itemlist.begin(); iter != itemlist.end(); ++iter) { if ((*iter)->equip_slot < EQ::invslot::EQUIPMENT_BEGIN || (*iter)->equip_slot > EQ::invslot::EQUIPMENT_END) { continue; } if ((*iter)->equip_slot == EQ::invslot::slotAmmo) { continue; } - + auto item = database.GetItem((*iter)->item_id); if (item == nullptr) { continue; } - + if (EQ::lightsource::IsLevelGreater(item->Light, m_Light.Type[EQ::lightsource::LightEquipment])) m_Light.Type[EQ::lightsource::LightEquipment] = item->Light; } @@ -1584,7 +1584,7 @@ void Corpse::UpdateEquipmentLight() uint8 general_light_type = 0; for (auto iter = itemlist.begin(); iter != itemlist.end(); ++iter) { if ((*iter)->equip_slot < EQ::invslot::GENERAL_BEGIN || (*iter)->equip_slot > EQ::invslot::GENERAL_END) { continue; } - + auto item = database.GetItem((*iter)->item_id); if (item == nullptr) { continue; } diff --git a/zone/exp.cpp b/zone/exp.cpp index 1a314b479..8f722b1f3 100644 --- a/zone/exp.cpp +++ b/zone/exp.cpp @@ -194,6 +194,10 @@ uint32 Client::CalcEXP(uint8 conlevel) { } } + if (RuleR(Character, FinalExpMultiplier) >= 0) { + in_add_exp *= RuleR(Character, FinalExpMultiplier); + } + return in_add_exp; } @@ -311,6 +315,10 @@ void Client::CalculateStandardAAExp(uint32 &add_aaxp, uint8 conlevel, bool resex } } + if (RuleR(Character, FinalExpMultiplier) >= 0) { + add_aaxp *= RuleR(Character, FinalExpMultiplier); + } + add_aaxp = (uint32)(RuleR(Character, AAExpMultiplier) * add_aaxp * aatotalmod); } @@ -466,6 +474,10 @@ void Client::CalculateExp(uint32 in_add_exp, uint32 &add_exp, uint32 &add_aaxp, } } + if (RuleR(Character, FinalExpMultiplier) >= 0) { + add_exp *= RuleR(Character, FinalExpMultiplier); + } + add_exp = GetEXP() + add_exp; } @@ -563,22 +575,22 @@ void Client::SetEXP(uint32 set_exp, uint32 set_aaxp, bool isrezzexp) { } if (isrezzexp) { - if (RuleI(Character, ShowExpValues) > 0) + if (RuleI(Character, ShowExpValues) > 0) Message(Chat::Experience, "You regain %s experience from resurrection. %s", exp_amount_message.c_str(), exp_percent_message.c_str()); else MessageString(Chat::Experience, REZ_REGAIN); } else { if (membercount > 1) { - if (RuleI(Character, ShowExpValues) > 0) + if (RuleI(Character, ShowExpValues) > 0) Message(Chat::Experience, "You have gained %s party experience! %s", exp_amount_message.c_str(), exp_percent_message.c_str()); else MessageString(Chat::Experience, GAIN_GROUPXP); } else if (IsRaidGrouped()) { - if (RuleI(Character, ShowExpValues) > 0) + if (RuleI(Character, ShowExpValues) > 0) Message(Chat::Experience, "You have gained %s raid experience! %s", exp_amount_message.c_str(), exp_percent_message.c_str()); else MessageString(Chat::Experience, GAIN_RAIDEXP); - } + } else { - if (RuleI(Character, ShowExpValues) > 0) + if (RuleI(Character, ShowExpValues) > 0) Message(Chat::Experience, "You have gained %s experience! %s", exp_amount_message.c_str(), exp_percent_message.c_str()); else MessageString(Chat::Experience, GAIN_XP); } @@ -660,7 +672,7 @@ void Client::SetEXP(uint32 set_exp, uint32 set_aaxp, bool isrezzexp) { if (RuleB(AA, SoundForAAEarned)) { SendSound(); } - + /* QS: PlayerLogAARate */ if (RuleB(QueryServ, PlayerLogAARate)){ int add_points = (m_pp.aapoints - last_unspentAA); @@ -801,7 +813,7 @@ void Client::SetLevel(uint8 set_level, bool command) /* QS: PlayerLogLevels */ if (RuleB(QueryServ, PlayerLogLevels)){ std::string event_desc = StringFormat("Leveled UP :: to Level:%i from Level:%i in zoneid:%i instid:%i", set_level, m_pp.level, this->GetZoneID(), this->GetInstanceID()); - QServ->PlayerLogEvent(Player_Log_Levels, this->CharacterID(), event_desc); + QServ->PlayerLogEvent(Player_Log_Levels, this->CharacterID(), event_desc); } } else if (set_level < m_pp.level){ @@ -839,7 +851,7 @@ void Client::SetLevel(uint8 set_level, bool command) SetHP(CalcMaxHP()); // Why not, lets give them a free heal } - if (RuleI(World, PVPMinLevel) > 0 && level >= RuleI(World, PVPMinLevel) && m_pp.pvp == 0) SetPVP(true); + if (RuleI(World, PVPMinLevel) > 0 && level >= RuleI(World, PVPMinLevel) && m_pp.pvp == 0) SetPVP(true); DoTributeUpdate(); SendHPUpdate(); @@ -943,32 +955,34 @@ uint32 Client::GetEXPForLevel(uint16 check_level) return finalxp; } -void Client::AddLevelBasedExp(uint8 exp_percentage, uint8 max_level, bool ignore_mods) -{ +void Client::AddLevelBasedExp(uint8 exp_percentage, uint8 max_level, bool ignore_mods) +{ uint32 award; uint32 xp_for_level; - if (exp_percentage > 100) - { - exp_percentage = 100; - } + if (exp_percentage > 100) + { + exp_percentage = 100; + } if (!max_level || GetLevel() < max_level) - { - max_level = GetLevel(); - } + { + max_level = GetLevel(); + } xp_for_level = GetEXPForLevel(max_level + 1) - GetEXPForLevel(max_level); - award = xp_for_level * exp_percentage / 100; + award = xp_for_level * exp_percentage / 100; - if(RuleB(Zone, LevelBasedEXPMods) && !ignore_mods) - { - if(zone->level_exp_mod[GetLevel()].ExpMod) - { + if (RuleB(Zone, LevelBasedEXPMods) && !ignore_mods) { + if (zone->level_exp_mod[GetLevel()].ExpMod) { award *= zone->level_exp_mod[GetLevel()].ExpMod; } } + if (RuleR(Character, FinalExpMultiplier) >= 0) { + award *= RuleR(Character, FinalExpMultiplier); + } + uint32 newexp = GetEXP() + award; SetEXP(newexp, GetAAXP()); } @@ -1126,7 +1140,7 @@ uint32 Client::GetCharMaxLevelFromQGlobal() { while(iter != globalMap.end()) { if((*iter).name.compare("CharMaxLevel") == 0){ return atoi((*iter).value.c_str()); - } + } ++iter; ++gcount; } diff --git a/zone/loottables.cpp b/zone/loottables.cpp index b7c343810..b4e0f00f0 100644 --- a/zone/loottables.cpp +++ b/zone/loottables.cpp @@ -523,22 +523,37 @@ void NPC::AddLootDrop( } } -void NPC::AddItem(const EQ::ItemData* item, uint16 charges, bool equipitem) { +void NPC::AddItem(const EQ::ItemData *item, uint16 charges, bool equipitem) +{ //slot isnt needed, its determined from the item. auto loot_drop_entry = NPC::NewLootDropEntry(); - loot_drop_entry.equip_item = static_cast(equipitem ? 1 : 0); + loot_drop_entry.equip_item = static_cast(equipitem ? 1 : 0); + loot_drop_entry.item_charges = charges; AddLootDrop(item, &itemlist, loot_drop_entry, true); } -void NPC::AddItem(uint32 itemid, uint16 charges, bool equipitem, uint32 aug1, uint32 aug2, uint32 aug3, uint32 aug4, uint32 aug5, uint32 aug6) { +void NPC::AddItem( + uint32 itemid, + uint16 charges, + bool equipitem, + uint32 aug1, + uint32 aug2, + uint32 aug3, + uint32 aug4, + uint32 aug5, + uint32 aug6 +) +{ //slot isnt needed, its determined from the item. - const EQ::ItemData * i = database.GetItem(itemid); - if(i == nullptr) + const EQ::ItemData *i = database.GetItem(itemid); + if (i == nullptr) { return; + } auto loot_drop_entry = NPC::NewLootDropEntry(); - loot_drop_entry.equip_item = static_cast(equipitem ? 1 : 0); + loot_drop_entry.equip_item = static_cast(equipitem ? 1 : 0); + loot_drop_entry.item_charges = charges; AddLootDrop(i, &itemlist, loot_drop_entry, true, aug1, aug2, aug3, aug4, aug5, aug6); } diff --git a/zone/mob_ai.cpp b/zone/mob_ai.cpp index df4a70e12..994724f0d 100644 --- a/zone/mob_ai.cpp +++ b/zone/mob_ai.cpp @@ -117,7 +117,8 @@ bool NPC::AICastSpell(Mob* tar, uint8 iChance, uint32 iSpellTypes, bool bInnates ( (spells[AIspells[i].spellid].targettype == ST_HateList || spells[AIspells[i].spellid].targettype == ST_AETargetHateList) || ( - (spells[AIspells[i].spellid].targettype==ST_AECaster || spells[AIspells[i].spellid].targettype==ST_AEBard) + // note: I think this check is actually wrong and we should be checking range instead in all cases, BUT if range is 0, range check is skipped? Works for now + (spells[AIspells[i].spellid].targettype==ST_AECaster || spells[AIspells[i].spellid].targettype==ST_AEBard || spells[AIspells[i].spellid].targettype==ST_AEClientV1) && dist2 <= spells[AIspells[i].spellid].aoerange*spells[AIspells[i].spellid].aoerange ) || dist2 <= spells[AIspells[i].spellid].range*spells[AIspells[i].spellid].range diff --git a/zone/zone.cpp b/zone/zone.cpp index d331d7866..66644edf1 100755 --- a/zone/zone.cpp +++ b/zone/zone.cpp @@ -2001,6 +2001,7 @@ bool ZoneDatabase::LoadStaticZonePoints(LinkedList *zone_point_list if (zone_point.is_virtual) { zone->virtual_zone_point_list.emplace_back(zone_point); + safe_delete(zp); continue; }