Include fixes from atys branch

ryzomclassic-develop
kaetemi 3 years ago
parent b4638c7969
commit 6a79a5bf0f
No known key found for this signature in database
GPG Key ID: 9873C4D40BB479BC

@ -4514,7 +4514,7 @@ NLMISC_COMMAND (connectUserChannel, "Connect to user channels", "<user id> <chan
{ {
string channelPass = inst->getPassUserChannel(channel); string channelPass = inst->getPassUserChannel(channel);
if ( (channel != DYN_CHAT_INVALID_CHAN) && (pass == nlstr("***")) && (c->havePriv(":DEV:") || c->havePriv(":SGM:") || c->havePriv(":GM:") || c->havePriv(":EM:"))) if ( pass == nlstr("***") && (c->havePriv(":DEV:") || c->havePriv(":SGM:") || c->havePriv(":GM:") || c->havePriv(":EM:")))
{ {
inst->deleteUserChannel(nameLwr); inst->deleteUserChannel(nameLwr);
} }
@ -4667,8 +4667,7 @@ NLMISC_COMMAND (webExecCommand, "Execute a web command", "<user id> <web_app_url
uint32 iindex; uint32 iindex;
NLMISC::fromString(index, iindex); NLMISC::fromString(index, iindex);
string command = args[3]; string command = args[3];
std::string hmac = args[4]; string hmac = args[4];
NLMISC::CHashKey hmacBin = NLMISC::CHashKey(hmac);
vector<string> infos; vector<string> infos;
CGameItemPtr item; CGameItemPtr item;
@ -4680,28 +4679,29 @@ NLMISC_COMMAND (webExecCommand, "Execute a web command", "<user id> <web_app_url
{ {
// Index of command must be higher than last used index to prevent re-use of commands // Index of command must be higher than last used index to prevent re-use of commands
if (send_url) if (send_url)
c->sendUrl(web_app_url+"&player_eid="+c->getId().toString()+"&event=failed&desc=bad_index", getSalt()); c->sendUrl(web_app_url+"&player_eid="+c->getId().toString()+"&event=failed&desc=bad_index");
return false; return false;
} }
if (next_step && (iindex != saved_index+1)) if (next_step && (iindex != saved_index+1))
{ {
// Next step commands wants an index who follow the last used index. // Next step commands wants an index who follow the last used index.
if (send_url) if (send_url)
c->sendUrl(web_app_url+"&player_eid="+c->getId().toString()+"&event=failed&desc=bad_next_index", getSalt()); c->sendUrl(web_app_url+"&player_eid="+c->getId().toString()+"&event=failed&desc=bad_next_index");
return false; return false;
} }
string salt = getSalt();
string checksumEid = web_app_url + toString(c->getLastConnectedDate()) + index + command + c->getId().toString(); string checksumEid = web_app_url + toString(c->getLastConnectedDate()) + index + command + c->getId().toString();
string checksumRowId = web_app_url + toString(c->getLastConnectedDate()) + index + command + toString(c->getEntityRowId().getIndex()); string checksumRowId = web_app_url + toString(c->getLastConnectedDate()) + index + command + toString(c->getEntityRowId().getIndex());
NLMISC::CHashKey realhmacEid = NLMISC::getHMacSHA1((uint8*)&checksumEid[0], checksumEid.size(), (uint8*)&salt[0], salt.size()); string salt = ArkSalt.get();
NLMISC::CHashKey realhmacRowId = NLMISC::getHMacSHA1((uint8*)&checksumRowId[0], checksumRowId.size(), (uint8*)&salt[0], salt.size());
if (realhmacEid != hmacBin && realhmacRowId != hmacBin && command != "is_valid_index") string realhmacEid = getHMacSHA1((uint8*)&checksumEid[0], checksumEid.size(), (uint8*)&salt[0], salt.size()).toString();
string realhmacRowId = getHMacSHA1((uint8*)&checksumRowId[0], checksumRowId.size(), (uint8*)&salt[0], salt.size()).toString();
if (realhmacEid != hmac && realhmacRowId != hmac && command != "is_valid_index")
{ {
if (send_url) if (send_url)
c->sendUrl(web_app_url+"&player_eid="+c->getId().toString()+"&event=failed&desc=bad_auth", getSalt()); c->sendUrl(web_app_url+"&player_eid="+c->getId().toString()+"&event=failed&desc=bad_auth");
return false; return false;
} }
} }
@ -4711,7 +4711,7 @@ NLMISC_COMMAND (webExecCommand, "Execute a web command", "<user id> <web_app_url
CInventoryPtr check_inv = c->getInventory(INVENTORIES::bag); CInventoryPtr check_inv = c->getInventory(INVENTORIES::bag);
if (!c->havePriv(":DEV:") || (web_app_url != "debug")) if (!c->havePriv(":DEV:") || (web_app_url != "debug"))
{ {
uint item_idx = c->checkWebCommand(web_app_url, index+command, hmac, getSalt()); uint item_idx = c->checkWebCommand(web_app_url, index+command, hmac, "");
if (item_idx == INVENTORIES::NbBagSlots) if (item_idx == INVENTORIES::NbBagSlots)
{ {
nlwarning("Bad web command check"); nlwarning("Bad web command check");
@ -4736,11 +4736,11 @@ NLMISC_COMMAND (webExecCommand, "Execute a web command", "<user id> <web_app_url
if (command == "is_valid_index") if (command == "is_valid_index")
{ {
if (!c->isValidWebCommandIndex(iindex)) { if (!c->isValidWebCommandIndex(iindex)) {
c->sendUrl(web_app_url+"&player_eid="+c->getId().toString()+"&event=failed&desc=unvalid_index", getSalt()); c->sendUrl(web_app_url+"&player_eid="+c->getId().toString()+"&event=failed&desc=unvalid_index");
} }
else else
{ {
c->sendUrl(web_app_url+"&player_eid="+c->getId().toString()+"&event=finished&desc=valid_index", getSalt()); c->sendUrl(web_app_url+"&player_eid="+c->getId().toString()+"&event=finished&desc=valid_index");
} }
return true; return true;
} }
@ -4782,7 +4782,7 @@ NLMISC_COMMAND (webExecCommand, "Execute a web command", "<user id> <web_app_url
if (inventory == NULL) if (inventory == NULL)
{ {
if (send_url) if (send_url)
c->sendUrl(web_app_url+"&player_eid="+c->getId().toString()+"&event=failed&desc=bad_inventory", getSalt()); c->sendUrl(web_app_url+"&player_eid="+c->getId().toString()+"&event=failed&desc=bad_inventory");
return false; return false;
} }
@ -4810,7 +4810,7 @@ NLMISC_COMMAND (webExecCommand, "Execute a web command", "<user id> <web_app_url
if ( (is_min_quality && numberItem < quantity) || (!is_min_quality && numberEqualItem < quantity) ) if ( (is_min_quality && numberItem < quantity) || (!is_min_quality && numberEqualItem < quantity) )
{ {
if (send_url) if (send_url)
c->sendUrl(web_app_url+"&player_eid="+c->getId().toString()+"&event=failed&desc=no_items", getSalt()); c->sendUrl(web_app_url+"&player_eid="+c->getId().toString()+"&event=failed&desc=no_items");
return false; return false;
} }
@ -4905,7 +4905,7 @@ NLMISC_COMMAND (webExecCommand, "Execute a web command", "<user id> <web_app_url
if( itemPtr->getSheetId() == sheetId && itemPtr->quality() == quality ) if( itemPtr->getSheetId() == sheetId && itemPtr->quality() == quality )
{ {
if (send_url) if (send_url)
c->sendUrl(web_app_url+"&player_eid="+c->getId().toString()+"&event=failed&desc=allready_have_item", getSalt()); c->sendUrl(web_app_url+"&player_eid="+c->getId().toString()+"&event=failed&desc=allready_have_item");
return false; return false;
} }
} }
@ -4922,20 +4922,24 @@ NLMISC_COMMAND (webExecCommand, "Execute a web command", "<user id> <web_app_url
{ {
new_item.deleteItem(); new_item.deleteItem();
if (send_url) if (send_url)
c->sendUrl(web_app_url+"&player_eid="+c->getId().toString()+"&event=failed&desc=cant_add_item", getSalt()); c->sendUrl(web_app_url+"&player_eid="+c->getId().toString()+"&event=failed&desc=cant_add_item");
return false; return false;
} }
if (new_item != NULL) // When the item is stacked, it's deleted by addItemToInventory. Need be checked again to prevent crash of egs if (new_item != NULL) // When the item is stacked, it's deleted by addItemToInventory. Need be checked again to prevent crash of egs
{ {
ucstring customValue;
if (command_args.size() >= 6 && command_args[5] != "*") if (command_args.size() >= 6 && command_args[5] != "*")
{ {
new_item->setPhraseId(command_args[5], true); customValue.fromUtf8(command_args[5]);
new_item->setCustomName(customValue);
} }
if (command_args.size() >= 7 && command_args[6] != "*") if (command_args.size() >= 7 && command_args[6] != "*")
{ {
new_item->setPhraseId(command_args[6], true); customValue.fromUtf8(command_args[6]);
new_item->setCustomText(customValue);
} }
if (command_args.size() >= 8) if (command_args.size() >= 8)
@ -4976,7 +4980,7 @@ NLMISC_COMMAND (webExecCommand, "Execute a web command", "<user id> <web_app_url
if ((x < min_x || y < min_y || x > max_x || y > max_y)) if ((x < min_x || y < min_y || x > max_x || y > max_y))
{ {
if (send_url) if (send_url)
c->sendUrl(web_app_url+"&player_eid="+c->getId().toString()+"&event=failed&desc=bad_position", getSalt()); c->sendUrl(web_app_url+"&player_eid="+c->getId().toString()+"&event=failed&desc=bad_position");
return false; return false;
} }
} }
@ -5005,7 +5009,7 @@ NLMISC_COMMAND (webExecCommand, "Execute a web command", "<user id> <web_app_url
if ((command_args[2] == "below" && fame > value) || (command_args[2] == "above" && fame < value)) if ((command_args[2] == "below" && fame > value) || (command_args[2] == "above" && fame < value))
{ {
if (send_url) if (send_url)
c->sendUrl(web_app_url+"&player_eid="+c->getId().toString()+"&event=failed&desc=bad_fame", getSalt()); c->sendUrl(web_app_url+"&player_eid="+c->getId().toString()+"&event=failed&desc=bad_fame");
return false; return false;
} }
@ -5045,10 +5049,10 @@ NLMISC_COMMAND (webExecCommand, "Execute a web command", "<user id> <web_app_url
if (command_args.size() == 4 || (command_args.size () == 5 && command_args[4] != "0")) if (command_args.size() == 4 || (command_args.size () == 5 && command_args[4] != "0"))
{ {
// Make sure fame values are properly capped. // Make sure fame values are properly capped.
CFameManager::getInstance().enforceFameCaps(c->getId(), c->getAllegiance()); CFameManager::getInstance().enforceFameCaps(c->getId(), c->getOrganization(), c->getAllegiance());
// set tribe fame threshold and clamp fame if necessary // set tribe fame threshold and clamp fame if necessary
CFameManager::getInstance().setAndEnforceTribeFameCap(c->getId(), c->getAllegiance()); CFameManager::getInstance().setAndEnforceTribeFameCap(c->getId(), c->getOrganization(), c->getAllegiance());
} }
} }
@ -5066,14 +5070,14 @@ NLMISC_COMMAND (webExecCommand, "Execute a web command", "<user id> <web_app_url
if (target == CEntityId::Unknown || target.getType() != RYZOMID::player) if (target == CEntityId::Unknown || target.getType() != RYZOMID::player)
{ {
if (send_url) if (send_url)
c->sendUrl(web_app_url+"&player_eid="+c->getId().toString()+"&event=failed&desc=bad_type", getSalt()); c->sendUrl(web_app_url+"&player_eid="+c->getId().toString()+"&event=failed&desc=bad_type");
return false; return false;
} }
CCharacter * targetTarget = dynamic_cast<CCharacter*>(CEntityBaseManager::getEntityBasePtr(target)); CCharacter * targetTarget = dynamic_cast<CCharacter*>(CEntityBaseManager::getEntityBasePtr(target));
if (targetTarget->getLeagueId() == DYN_CHAT_INVALID_CHAN || c->getLeagueId() != targetTarget->getLeagueId()) if (targetTarget->getLeagueId() == DYN_CHAT_INVALID_CHAN || c->getLeagueId() != targetTarget->getLeagueId())
{ {
if (send_url) if (send_url)
c->sendUrl(web_app_url+"&player_eid="+c->getId().toString()+"&event=failed&desc=bad_league", getSalt()); c->sendUrl(web_app_url+"&player_eid="+c->getId().toString()+"&event=failed&desc=bad_league");
return false; return false;
} }
} }
@ -5082,14 +5086,14 @@ NLMISC_COMMAND (webExecCommand, "Execute a web command", "<user id> <web_app_url
if (target == CEntityId::Unknown || target.getType() != RYZOMID::player) if (target == CEntityId::Unknown || target.getType() != RYZOMID::player)
{ {
if (send_url) if (send_url)
c->sendUrl(web_app_url+"&player_eid="+c->getId().toString()+"&event=failed&desc=bad_type", getSalt()); c->sendUrl(web_app_url+"&player_eid="+c->getId().toString()+"&event=failed&desc=bad_type");
return false; return false;
} }
CCharacter * targetTarget = dynamic_cast<CCharacter*>(CEntityBaseManager::getEntityBasePtr(target)); CCharacter * targetTarget = dynamic_cast<CCharacter*>(CEntityBaseManager::getEntityBasePtr(target));
if (targetTarget->getGuildId() == 0 || c->getGuildId() != targetTarget->getGuildId()) if (targetTarget->getGuildId() == 0 || c->getGuildId() != targetTarget->getGuildId())
{ {
if (send_url) if (send_url)
c->sendUrl(web_app_url+"&player_eid="+c->getId().toString()+"&event=failed&desc=bad_guild", getSalt()); c->sendUrl(web_app_url+"&player_eid="+c->getId().toString()+"&event=failed&desc=bad_guild");
return false; return false;
} }
} }
@ -5098,14 +5102,14 @@ NLMISC_COMMAND (webExecCommand, "Execute a web command", "<user id> <web_app_url
if (target == CEntityId::Unknown || target.getType() != RYZOMID::player) if (target == CEntityId::Unknown || target.getType() != RYZOMID::player)
{ {
if (send_url) if (send_url)
c->sendUrl(web_app_url+"&player_eid="+c->getId().toString()+"&event=failed&desc=bad_type", getSalt()); c->sendUrl(web_app_url+"&player_eid="+c->getId().toString()+"&event=failed&desc=bad_type");
return false; return false;
} }
CCharacter * targetTarget = dynamic_cast<CCharacter*>(CEntityBaseManager::getEntityBasePtr(target)); CCharacter * targetTarget = dynamic_cast<CCharacter*>(CEntityBaseManager::getEntityBasePtr(target));
if (targetTarget->getTeamId() == CTEAM::InvalidTeamId || c->getTeamId() != targetTarget->getTeamId()) if (targetTarget->getTeamId() == CTEAM::InvalidTeamId || c->getTeamId() != targetTarget->getTeamId())
{ {
if (send_url) if (send_url)
c->sendUrl(web_app_url+"&player_eid="+c->getId().toString()+"&event=failed&desc=bad_team", getSalt()); c->sendUrl(web_app_url+"&player_eid="+c->getId().toString()+"&event=failed&desc=bad_team");
return false; return false;
} }
} }
@ -5120,7 +5124,7 @@ NLMISC_COMMAND (webExecCommand, "Execute a web command", "<user id> <web_app_url
if (creature == NULL || creatureSheetId == CSheetId::Unknown || creatureSheetId != creature->getType()) if (creature == NULL || creatureSheetId == CSheetId::Unknown || creatureSheetId != creature->getType())
{ {
if (send_url) if (send_url)
c->sendUrl(web_app_url+"&player_eid="+c->getId().toString()+"&event=failed&desc=bad_sheet", getSalt()); c->sendUrl(web_app_url+"&player_eid="+c->getId().toString()+"&event=failed&desc=bad_sheet");
return false; return false;
} }
} }
@ -5129,7 +5133,7 @@ NLMISC_COMMAND (webExecCommand, "Execute a web command", "<user id> <web_app_url
if (target == CEntityId::Unknown || target.getType() == RYZOMID::player) if (target == CEntityId::Unknown || target.getType() == RYZOMID::player)
{ {
if (send_url) if (send_url)
c->sendUrl(web_app_url+"&player_eid="+c->getId().toString()+"&event=failed&desc=bad_type", getSalt()); c->sendUrl(web_app_url+"&player_eid="+c->getId().toString()+"&event=failed&desc=bad_type");
return false; return false;
} }
vector<TAIAlias> aliases; vector<TAIAlias> aliases;
@ -5147,7 +5151,7 @@ NLMISC_COMMAND (webExecCommand, "Execute a web command", "<user id> <web_app_url
if (!found) if (!found)
{ {
if (send_url) if (send_url)
c->sendUrl(web_app_url+"&player_eid="+c->getId().toString()+"&event=failed&desc=bad_bot", getSalt()); c->sendUrl(web_app_url+"&player_eid="+c->getId().toString()+"&event=failed&desc=bad_bot");
return false; return false;
} }
} }
@ -5156,14 +5160,14 @@ NLMISC_COMMAND (webExecCommand, "Execute a web command", "<user id> <web_app_url
if (target == CEntityId::Unknown || target.getType() != RYZOMID::player) if (target == CEntityId::Unknown || target.getType() != RYZOMID::player)
{ {
if (send_url) if (send_url)
c->sendUrl(web_app_url+"&player_eid="+c->getId().toString()+"&event=failed&desc=bad_type", getSalt()); c->sendUrl(web_app_url+"&player_eid="+c->getId().toString()+"&event=failed&desc=bad_type");
return false; return false;
} }
CEntityBase *entityBase = PlayerManager.getCharacterByName(CShardNames::getInstance().makeFullNameFromRelative(c->getHomeMainlandSessionId(), command_args[2])); CEntityBase *entityBase = PlayerManager.getCharacterByName(CShardNames::getInstance().makeFullNameFromRelative(c->getHomeMainlandSessionId(), command_args[2]));
if (entityBase == NULL) if (entityBase == NULL)
{ {
if (send_url) if (send_url)
c->sendUrl(web_app_url+"&player_eid="+c->getId().toString()+"&event=failed&desc=bad_player", getSalt()); c->sendUrl(web_app_url+"&player_eid="+c->getId().toString()+"&event=failed&desc=bad_player");
return false; return false;
} }
} else } else
@ -5180,7 +5184,7 @@ NLMISC_COMMAND (webExecCommand, "Execute a web command", "<user id> <web_app_url
if (!c->haveBrick(CSheetId(command_args[1]))) if (!c->haveBrick(CSheetId(command_args[1])))
{ {
if (send_url) if (send_url)
c->sendUrl(web_app_url+"&player_eid="+c->getId().toString()+"&event=failed&desc=no_brick", getSalt()); c->sendUrl(web_app_url+"&player_eid="+c->getId().toString()+"&event=failed&desc=no_brick");
return false; return false;
} }
} }
@ -5203,7 +5207,7 @@ NLMISC_COMMAND (webExecCommand, "Execute a web command", "<user id> <web_app_url
else else
{ {
if (send_url) if (send_url)
c->sendUrl(web_app_url+"&player_eid="+c->getId().toString()+"&event=failed&desc=bad_brick_action", getSalt()); c->sendUrl(web_app_url+"&player_eid="+c->getId().toString()+"&event=failed&desc=bad_brick_action");
return false; return false;
} }
} }
@ -5234,7 +5238,7 @@ NLMISC_COMMAND (webExecCommand, "Execute a web command", "<user id> <web_app_url
if (inventory == NULL) if (inventory == NULL)
{ {
if (send_url) if (send_url)
c->sendUrl(web_app_url+"&player_eid="+c->getId().toString()+"&event=failed&desc=bad_inventory", getSalt()); c->sendUrl(web_app_url+"&player_eid="+c->getId().toString()+"&event=failed&desc=bad_inventory");
return false; return false;
} }
@ -5270,7 +5274,7 @@ NLMISC_COMMAND (webExecCommand, "Execute a web command", "<user id> <web_app_url
if (command_args[0] == "check_item") if (command_args[0] == "check_item")
{ {
if (send_url) if (send_url)
c->sendUrl(web_app_url+"&player_eid="+c->getId().toString()+"&event=failed&desc=no_items", getSalt()); c->sendUrl(web_app_url+"&player_eid="+c->getId().toString()+"&event=failed&desc=no_items");
return false; return false;
} }
} }
@ -5279,7 +5283,7 @@ NLMISC_COMMAND (webExecCommand, "Execute a web command", "<user id> <web_app_url
if (command_args[0] == "check_no_item") if (command_args[0] == "check_no_item")
{ {
if (send_url) if (send_url)
c->sendUrl(web_app_url+"&player_eid="+c->getId().toString()+"&event=failed&desc=have_items", getSalt()); c->sendUrl(web_app_url+"&player_eid="+c->getId().toString()+"&event=failed&desc=have_items");
return false; return false;
} }
} }
@ -5317,7 +5321,7 @@ NLMISC_COMMAND (webExecCommand, "Execute a web command", "<user id> <web_app_url
(command_args[2] == "defend" && outpost->getState() != OUTPOSTENUMS::DefenseRound)) (command_args[2] == "defend" && outpost->getState() != OUTPOSTENUMS::DefenseRound))
{ {
if (send_url) if (send_url)
c->sendUrl(web_app_url+"&player_eid="+c->getId().toString()+"&event=failed&desc="+command_args[2], getSalt()); c->sendUrl(web_app_url+"&player_eid="+c->getId().toString()+"&event=failed&desc="+command_args[2]);
return false; return false;
} }
} }
@ -5703,7 +5707,7 @@ NLMISC_COMMAND (webExecCommand, "Execute a web command", "<user id> <web_app_url
else else
{ {
if (send_url) if (send_url)
c->sendUrl(web_app_url+"&player_eid="+c->getId().toString()+"&event=failed&desc=no_vpx_def", getSalt()); c->sendUrl(web_app_url+"&player_eid="+c->getId().toString()+"&event=failed&desc=no_vpx_def");
} }
} }
//************************************************* //*************************************************
@ -6012,7 +6016,12 @@ NLMISC_COMMAND (webExecCommand, "Execute a web command", "<user id> <web_app_url
{ {
CBuildingManager::getInstance()->removePlayerFromRoom( c ); CBuildingManager::getInstance()->removePlayerFromRoom( c );
uint16 ownerId = buildingPlayer->getOwnerIdx( entityBase->getId() ); uint16 ownerId = buildingPlayer->getOwnerIdx( entityBase->getId() );
nlinfo("Gettting ownerId : %d", ownerId);
buildingPlayer->addUser(c, 0, ownerId, cell); buildingPlayer->addUser(c, 0, ownerId, cell);
//CBuildingManager::getInstance()->setRoomLifeTime(cell, TGameCycle(NLMISC::TGameTime(4*60*60) / CTickEventHandler::getGameTimeStep()));
nlinfo("Gettting cell : %d", cell);
c->teleportCharacter(x,y,z,allowPetTp,true,h,0xFF,cell); c->teleportCharacter(x,y,z,allowPetTp,true,h,0xFF,cell);
} }
//} //}
@ -6145,7 +6154,7 @@ NLMISC_COMMAND (webExecCommand, "Execute a web command", "<user id> <web_app_url
if (c->getSkillValue(skillEnum) < wantedValue) { if (c->getSkillValue(skillEnum) < wantedValue) {
if (send_url) if (send_url)
c->sendUrl(web_app_url+"&player_eid="+c->getId().toString()+"&event=failed&desc=no_enough_skill", getSalt()); c->sendUrl(web_app_url+"&player_eid="+c->getId().toString()+"&event=failed&desc=no_enough_skill");
return true; return true;
} }
} }
@ -6157,7 +6166,7 @@ NLMISC_COMMAND (webExecCommand, "Execute a web command", "<user id> <web_app_url
if (c->getBestChildSkillValue(skillEnum) < wantedValue) { if (c->getBestChildSkillValue(skillEnum) < wantedValue) {
if (send_url) if (send_url)
c->sendUrl(web_app_url+"&player_eid="+c->getId().toString()+"&event=failed&desc=no_best_skill", getSalt()); c->sendUrl(web_app_url+"&player_eid="+c->getId().toString()+"&event=failed&desc=no_best_skill");
return true; return true;
} }
} }
@ -6183,7 +6192,7 @@ NLMISC_COMMAND (webExecCommand, "Execute a web command", "<user id> <web_app_url
{ {
if (!c->isDead()) { if (!c->isDead()) {
if (send_url) if (send_url)
c->sendUrl(web_app_url+"&player_eid="+c->getId().toString()+"&event=failed&desc=not_dead", getSalt()); c->sendUrl(web_app_url+"&player_eid="+c->getId().toString()+"&event=failed&desc=not_dead");
return true; return true;
} }
} }
@ -6191,7 +6200,7 @@ NLMISC_COMMAND (webExecCommand, "Execute a web command", "<user id> <web_app_url
{ {
if (c->isDead()) { if (c->isDead()) {
if (send_url) if (send_url)
c->sendUrl(web_app_url+"&player_eid="+c->getId().toString()+"&event=failed&desc=not_alive", getSalt()); c->sendUrl(web_app_url+"&player_eid="+c->getId().toString()+"&event=failed&desc=not_alive");
return true; return true;
} }
} }
@ -6199,7 +6208,7 @@ NLMISC_COMMAND (webExecCommand, "Execute a web command", "<user id> <web_app_url
{ {
if (!c->getPVPFlag()) { if (!c->getPVPFlag()) {
if (send_url) if (send_url)
c->sendUrl(web_app_url+"&player_eid="+c->getId().toString()+"&event=failed&desc=not_tag", getSalt()); c->sendUrl(web_app_url+"&player_eid="+c->getId().toString()+"&event=failed&desc=not_tag");
return true; return true;
} }
} }
@ -6207,7 +6216,7 @@ NLMISC_COMMAND (webExecCommand, "Execute a web command", "<user id> <web_app_url
{ {
if (!c->getPvPRecentActionFlag()) { if (!c->getPvPRecentActionFlag()) {
if (send_url) if (send_url)
c->sendUrl(web_app_url+"&player_eid="+c->getId().toString()+"&event=failed&desc=not_flag", getSalt()); c->sendUrl(web_app_url+"&player_eid="+c->getId().toString()+"&event=failed&desc=not_flag");
return true; return true;
} }
} }
@ -6229,7 +6238,7 @@ NLMISC_COMMAND (webExecCommand, "Execute a web command", "<user id> <web_app_url
fromString(command_args[2], wantedMoney); fromString(command_args[2], wantedMoney);
if (c->getMoney() < wantedMoney) { if (c->getMoney() < wantedMoney) {
if (send_url) if (send_url)
c->sendUrl(web_app_url+"&player_eid="+c->getId().toString()+"&event=failed&desc=no_enough_money", getSalt()); c->sendUrl(web_app_url+"&player_eid="+c->getId().toString()+"&event=failed&desc=no_enough_money");
return true; return true;
} }
} }
@ -6259,7 +6268,7 @@ NLMISC_COMMAND (webExecCommand, "Execute a web command", "<user id> <web_app_url
if (guild == NULL) if (guild == NULL)
{ {
if (send_url) if (send_url)
c->sendUrl(web_app_url+"&player_eid="+c->getId().toString()+"&event=failed&desc=no_guild", getSalt()); c->sendUrl(web_app_url+"&player_eid="+c->getId().toString()+"&event=failed&desc=no_guild");
return true; return true;
} }
@ -6271,7 +6280,7 @@ NLMISC_COMMAND (webExecCommand, "Execute a web command", "<user id> <web_app_url
fromString(command_args[2], wantedMoney); fromString(command_args[2], wantedMoney);
if (guild->getMoney() < wantedMoney) { if (guild->getMoney() < wantedMoney) {
if (send_url) if (send_url)
c->sendUrl(web_app_url+"&player_eid="+c->getId().toString()+"&event=failed&desc=no_enough_money", getSalt()); c->sendUrl(web_app_url+"&player_eid="+c->getId().toString()+"&event=failed&desc=no_enough_money");
return true; return true;
} }
} }
@ -6303,7 +6312,7 @@ NLMISC_COMMAND (webExecCommand, "Execute a web command", "<user id> <web_app_url
if( memberGrade > wanted_grade) if( memberGrade > wanted_grade)
{ {
if (send_url) if (send_url)
c->sendUrl(web_app_url+"&player_eid="+c->getId().toString()+"&event=failed&desc=no_enough_rank", getSalt()); c->sendUrl(web_app_url+"&player_eid="+c->getId().toString()+"&event=failed&desc=no_enough_rank");
return true; return true;
} }
} }
@ -6355,7 +6364,7 @@ NLMISC_COMMAND (webExecCommand, "Execute a web command", "<user id> <web_app_url
if (c->getFactionPoint(clan) < value) if (c->getFactionPoint(clan) < value)
{ {
if (send_url) if (send_url)
c->sendUrl(web_app_url+"&player_eid="+c->getId().toString()+"&event=failed&desc=no_enough_faction_points", getSalt()); c->sendUrl(web_app_url+"&player_eid="+c->getId().toString()+"&event=failed&desc=no_enough_faction_points");
return true; return true;
} }
} }
@ -6394,7 +6403,7 @@ NLMISC_COMMAND (webExecCommand, "Execute a web command", "<user id> <web_app_url
if (c->getPvpPoint() < value) if (c->getPvpPoint() < value)
{ {
if (send_url) if (send_url)
c->sendUrl(web_app_url+"&player_eid="+c->getId().toString()+"&event=failed&desc=no_enough_pvp_points", getSalt()); c->sendUrl(web_app_url+"&player_eid="+c->getId().toString()+"&event=failed&desc=no_enough_pvp_points");
return true; return true;
} }
} }
@ -6480,7 +6489,7 @@ NLMISC_COMMAND (webExecCommand, "Execute a web command", "<user id> <web_app_url
destPlayer = dynamic_cast<CCharacter*>(CEntityBaseManager::getEntityBasePtr(target)); destPlayer = dynamic_cast<CCharacter*>(CEntityBaseManager::getEntityBasePtr(target));
} }
if (destPlayer) if (destPlayer)
destPlayer->sendUrl(app+" "+params, ""); destPlayer->sendUrl(app+" "+params);
} }
@ -6574,6 +6583,12 @@ NLMISC_COMMAND (webExecCommand, "Execute a web command", "<user id> <web_app_url
c->removeMission(missionAlias, 0); c->removeMission(missionAlias, 0);
c->removeMissionFromHistories(missionAlias); c->removeMissionFromHistories(missionAlias);
} }
else if (action == "finish")
{
TAIAlias missionAlias = CAIAliasTranslator::getInstance()->getMissionUniqueIdFromName(command_args[2]);
c->removeMission(missionAlias, 0, true);
c->removeMissionFromHistories(missionAlias);
}
else if (action == "add_compass" && command_args.size() == 4) else if (action == "add_compass" && command_args.size() == 4)
{ {
TVectorParamCheck params(1); TVectorParamCheck params(1);
@ -6648,7 +6663,7 @@ NLMISC_COMMAND (webExecCommand, "Execute a web command", "<user id> <web_app_url
} }
else else
{ {
c->sendUrl(web_app_url+"&player_eid="+c->getId().toString()+"&event=finished", getSalt()); c->sendUrl(web_app_url+"&player_eid="+c->getId().toString()+"&event=finished");
} }
} }
else else
@ -6658,7 +6673,7 @@ NLMISC_COMMAND (webExecCommand, "Execute a web command", "<user id> <web_app_url
c->validateWebCommandIndex(iindex); c->validateWebCommandIndex(iindex);
} }
if (send_url) if (send_url)
c->sendUrl(web_app_url+"&player_eid="+c->getId().toString()+"&event=finished", getSalt()); c->sendUrl(web_app_url+"&player_eid="+c->getId().toString()+"&event=finished");
} }
} }
else else
@ -6667,7 +6682,7 @@ NLMISC_COMMAND (webExecCommand, "Execute a web command", "<user id> <web_app_url
if (save_index) if (save_index)
c->validateWebCommandIndex(iindex); c->validateWebCommandIndex(iindex);
if (send_url) if (send_url)
c->sendUrl(web_app_url+"&player_eid="+c->getId().toString()+"&event=finished", getSalt()); c->sendUrl(web_app_url+"&player_eid="+c->getId().toString()+"&event=finished");
} }
return true; return true;
@ -8118,6 +8133,8 @@ NLMISC_COMMAND(eScript, "executes a script on an event npc group", "<player eid>
pos = arg.find("(eid:"); pos = arg.find("(eid:");
} }
strFindReplace(arg, "#item:", "");
strFindReplace(arg, "#rrp:", "");
msgout.serial(arg); msgout.serial(arg);
} }
CWorldInstances::instance().msgToAIInstance2(instanceNumber, msgout); CWorldInstances::instance().msgToAIInstance2(instanceNumber, msgout);

@ -3710,7 +3710,7 @@ TUnifiedCallbackItem CbClientArray[]=
{ "CLIENT:MISSION:WAKE", cbClientMissionWake }, { "CLIENT:MISSION:WAKE", cbClientMissionWake },
{ "CLIENT:MISSION:GROUP_WAKE", cbClientMissionGroupWake }, { "CLIENT:MISSION:GROUP_WAKE", cbClientMissionGroupWake },
// { "CLIENT:EVENT:SET_ITEM_CUSTOM_TEXT", cbClientEventSetItemCustomText }, // { "CLIENT:EVENT:SET_ITEM_CUSTOM_TEXT", cbClientEventSetItemCustomText }, // Moved to ITEM:WRITE
{ "CLIENT:TOTEM:BUILD", cbTotemBuild }, { "CLIENT:TOTEM:BUILD", cbTotemBuild },

@ -228,36 +228,32 @@ std::vector<TChanID> CPVPManager2::getCharacterChannels(CCharacter * user)
NLMISC::splitString(user->getLangChannel(), " ", langChannels); NLMISC::splitString(user->getLangChannel(), " ", langChannels);
for ( uint i = 0; i < langChannels.size(); i++ ) for ( uint i = 0; i < langChannels.size(); i++ )
{ {
TMAPExtraFactionChannel::iterator it = _ExtraFactionChannel.find(langChannels[i]); if (langChannels[i] != "rf")
{
TMAPExtraFactionChannel::iterator it = _ExtraFactionChannel.find("usr_"+langChannels[i]);
if (it != _ExtraFactionChannel.end()) if (it != _ExtraFactionChannel.end())
{ {
result.push_back((*it).second); result.push_back((*it).second);
} }
} }
} }
else }
{
TMAPExtraFactionChannel::iterator it = _ExtraFactionChannel.find("en"); TMAPExtraFactionChannel::iterator it = _ExtraFactionChannel.find("rf");
if (it != _ExtraFactionChannel.end()) if (it != _ExtraFactionChannel.end())
{ {
result.push_back((*it).second); result.push_back((*it).second);
} }
}
#endif
#ifdef RYZOM_FORGE
PVP_CLAN::TPVPClan faction = user->getAllegiance().first; PVP_CLAN::TPVPClan faction = user->getAllegiance().first;
if( faction != PVP_CLAN::Neutral ) if( faction != PVP_CLAN::Neutral )
{
if (isFactionInWar(faction))
{ {
TMAPFactionChannel::iterator it = _FactionChannel.find(faction); TMAPFactionChannel::iterator it = _FactionChannel.find(faction);
if (it != _FactionChannel.end()) if( it != _FactionChannel.end() )
{ {
result.push_back((*it).second); result.push_back((*it).second);
} }
} }
}
faction = user->getAllegiance().second; faction = user->getAllegiance().second;
if( faction != PVP_CLAN::Neutral ) if( faction != PVP_CLAN::Neutral )
@ -268,6 +264,25 @@ std::vector<TChanID> CPVPManager2::getCharacterChannels(CCharacter * user)
result.push_back((*it).second); result.push_back((*it).second);
} }
} }
// Organizations
if (user->getOrganization() == 5) // marauder
{
TMAPExtraFactionChannel::iterator it = _ExtraFactionChannel.find("marauders");
if (it != _ExtraFactionChannel.end())
{
result.push_back((*it).second);
}
}
if (user->getOrganization() == 7) // ranger
{
TMAPExtraFactionChannel::iterator it = _ExtraFactionChannel.find("ranger");
if (it != _ExtraFactionChannel.end())
{
result.push_back((*it).second);
}
}
#endif #endif
/* /*

@ -124,6 +124,10 @@ CGameItemPtr CNamedItems::createNamedItem(const std::string & name, uint32 quant
if( itemSrc == NULL ) if( itemSrc == NULL )
return NULL; return NULL;
CGameItemPtr item = itemSrc->getItemCopy(); CGameItemPtr item = itemSrc->getItemCopy();
quantity = min(quantity, item->getMaxStackSize());
item->setStackSize(quantity);
return item; return item;
} }

@ -29,6 +29,7 @@
#include <deque> #include <deque>
#include <exception> #include <exception>
#include <fstream> #include <fstream>
#include <functional>
#include <iostream> #include <iostream>
#include <limits> #include <limits>
#include <list> #include <list>
@ -37,7 +38,6 @@
#include <string> #include <string>
#include <utility> #include <utility>
#include <vector> #include <vector>
#include <functional>
// NeL georges // NeL georges
#include "nel/georges/load_form.h" #include "nel/georges/load_form.h"

Loading…
Cancel
Save