Merge branch 'ark'

feature/prepare-cross-merge
Ulukyn 4 years ago committed by kaetemi
parent 3c178cb506
commit 578ae687df
No known key found for this signature in database
GPG Key ID: 9873C4D40BB479BC

@ -565,6 +565,9 @@ CInventoryPtr getInventory(CCharacter *c, const string &inv)
case INVENTORIES::pet_animal2: case INVENTORIES::pet_animal2:
case INVENTORIES::pet_animal3: case INVENTORIES::pet_animal3:
case INVENTORIES::pet_animal4: case INVENTORIES::pet_animal4:
case INVENTORIES::pet_animal5:
case INVENTORIES::pet_animal6:
case INVENTORIES::pet_animal7:
case INVENTORIES::guild: case INVENTORIES::guild:
case INVENTORIES::player_room: case INVENTORIES::player_room:
inventoryPtr = c->getInventory(selectedInv); inventoryPtr = c->getInventory(selectedInv);
@ -590,6 +593,9 @@ INVENTORIES::TInventory getTInventory(const string &inv)
case INVENTORIES::pet_animal2: case INVENTORIES::pet_animal2:
case INVENTORIES::pet_animal3: case INVENTORIES::pet_animal3:
case INVENTORIES::pet_animal4: case INVENTORIES::pet_animal4:
case INVENTORIES::pet_animal5:
case INVENTORIES::pet_animal6:
case INVENTORIES::pet_animal7:
case INVENTORIES::guild: case INVENTORIES::guild:
case INVENTORIES::player_room: case INVENTORIES::player_room:
inventory = strinv; inventory = strinv;
@ -802,6 +808,9 @@ NLMISC_COMMAND(getItemList, "get list of items of character by filter", "<uid> [
inventories.push_back(INVENTORIES::pet_animal2); inventories.push_back(INVENTORIES::pet_animal2);
inventories.push_back(INVENTORIES::pet_animal3); inventories.push_back(INVENTORIES::pet_animal3);
inventories.push_back(INVENTORIES::pet_animal4); inventories.push_back(INVENTORIES::pet_animal4);
inventories.push_back(INVENTORIES::pet_animal5);
inventories.push_back(INVENTORIES::pet_animal6);
inventories.push_back(INVENTORIES::pet_animal7);
inventories.push_back(INVENTORIES::guild); inventories.push_back(INVENTORIES::guild);
inventories.push_back(INVENTORIES::player_room); inventories.push_back(INVENTORIES::player_room);
} }
@ -902,6 +911,9 @@ NLMISC_COMMAND(getNamedItemList, "get list of named items of character by filter
inventories.push_back(INVENTORIES::pet_animal2); inventories.push_back(INVENTORIES::pet_animal2);
inventories.push_back(INVENTORIES::pet_animal3); inventories.push_back(INVENTORIES::pet_animal3);
inventories.push_back(INVENTORIES::pet_animal4); inventories.push_back(INVENTORIES::pet_animal4);
inventories.push_back(INVENTORIES::pet_animal5);
inventories.push_back(INVENTORIES::pet_animal6);
inventories.push_back(INVENTORIES::pet_animal7);
inventories.push_back(INVENTORIES::guild); inventories.push_back(INVENTORIES::guild);
inventories.push_back(INVENTORIES::player_room); inventories.push_back(INVENTORIES::player_room);
} }
@ -3215,6 +3227,16 @@ NLMISC_COMMAND(getPlayerPets, "get player pets", "<uid>")
return true; return true;
} }
//----------------------------------------------------------------------------
NLMISC_COMMAND(getPlayerPetsInfos, "get player pets infos", "<uid>")
{
GET_ACTIVE_CHARACTER
string pets = c->getPetsInfos();
log.displayNL("%s", pets.c_str());
return true;
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
NLMISC_COMMAND(spawnPlayerPet, "spawn player pet", "<uid> <slot>") NLMISC_COMMAND(spawnPlayerPet, "spawn player pet", "<uid> <slot>")
@ -3236,6 +3258,24 @@ NLMISC_COMMAND(spawnPlayerPet, "spawn player pet", "<uid> <slot>")
return true; return true;
} }
//----------------------------------------------------------------------------
NLMISC_COMMAND(removePlayerPet, "put player pet", "<uid> <slot> [<keepInventory=0|1>]")
{
if (args.size() < 2)
return false;
GET_ACTIVE_CHARACTER
uint32 index;
fromString(args[1], index);
bool keepInventory = args.size() > 2 && args[2] == "1";
c->removeAnimalIndex(index, CPetCommandMsg::LIBERATE, keepInventory);
return true;
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
NLMISC_COMMAND(setPlayerPetName, "change the name of a player pet", "<uid> <index> <name>") NLMISC_COMMAND(setPlayerPetName, "change the name of a player pet", "<uid> <index> <name>")
{ {
@ -4355,7 +4395,7 @@ NLMISC_COMMAND(despawnTargetSource, "Despawn the target source", "<uid>")
{ {
TDataSetRow sourceRowId = c->getTargetDataSetRow(); TDataSetRow sourceRowId = c->getTargetDataSetRow();
CHarvestSource *source = CHarvestSourceManager::getInstance()->getEntity( sourceRowId ); CHarvestSource *source = CHarvestSourceManager::getInstance()->getEntity( sourceRowId );
if (!source->wasProspected()) if (source && !source->wasProspected())
{ {
source->spawnEnd(false); source->spawnEnd(false);
log.displayNL("OK"); log.displayNL("OK");
@ -4366,3 +4406,40 @@ NLMISC_COMMAND(despawnTargetSource, "Despawn the target source", "<uid>")
log.displayNL("ERR"); log.displayNL("ERR");
return true; return true;
} }
//----------------------------------------------------------------------------
NLMISC_COMMAND(setServerPhrase, "Set an IOS phrase", "<id> <phrase> [<language code>]")
{
if (args.size() < 2)
return false;
string phraseName = args[0];
ucstring content;
content.fromUtf8(args[1]);
ucstring phraseContent = phraseName;
phraseContent += "(){[";
phraseContent += content;
phraseContent += "]}";
string msgname = "SET_PHRASE";
bool withLang = false;
string lang = "";
if (args.size() == 3)
{
lang = args[2];
if (lang != "all")
{
withLang = true;
msgname = "SET_PHRASE_LANG";
}
}
NLNET::CMessage msgout(msgname);
msgout.serial(phraseName);
msgout.serial(phraseContent);
if (withLang)
msgout.serial(lang);
sendMessageViaMirror("IOS", msgout);
return true;
}

@ -5933,6 +5933,62 @@ string CCharacter::getPets()
return pets; return pets;
} }
string CCharacter::getPetsInfos()
{
string pets = "";
for (sint32 i = 0; i < (sint32)_PlayerPets.size(); ++i)
{
string sheet = _PlayerPets[i].PetSheetId.toString();
string ticketSheet = _PlayerPets[i].TicketPetSheetId.toString();
uint32 timeBeforeDespawn = 0;
if (CTickEventHandler::getGameCycle() <= _PlayerPets[i].DeathTick + 3 * 24 * 36000)
timeBeforeDespawn = (uint32)((_PlayerPets[i].DeathTick + 3 * 24 * 36000) - CTickEventHandler::getGameCycle());
string inBag = "0";
if (_PlayerPets[i].IsInBag)
inBag = "1";
string spawnFlag = "0";
if (_PlayerPets[i].spawnFlag)
spawnFlag = "1";
string name = _PlayerPets[i].CustomName.toUtf8();
string type = "X";
string state = "0";
if (_PlayerPets[i].TicketPetSheetId != CSheetId::Unknown)
{
const CStaticItem* form = CSheets::getForm(_PlayerPets[i].TicketPetSheetId);
if (form->Type == ITEM_TYPE::MEKTOUB_MOUNT_TICKET)
type = "M";
else if (form->Type == ITEM_TYPE::MEKTOUB_PACKER_TICKET)
type = "P";
else if (form->Type == ITEM_TYPE::ANIMAL_TICKET)
type = "A";
}
CPetAnimal::TStatus status = _PlayerPets[i].PetStatus;
if (status != CPetAnimal::db_unknown)
state = toString("%d", (uint32)(status));
else
state += "0";
uint32 packInv = INVENTORIES::pet_animal + i;
uint32 slots = _Inventory[packInv]->getUsedSlotCount();
uint32 bulk = _Inventory[packInv]->getInventoryBulk();
uint32 max_bulk = _Inventory[packInv]->getMaxBulk();
uint32 weight = _Inventory[packInv]->getInventoryWeight();
uint32 max_weight = _Inventory[packInv]->getMaxWeight();
pets += sheet+"|"+ticketSheet+"|"+type+"|"+state+"|"+toString("%d", _PlayerPets[i].Size)+"|"+toString("%d", _PlayerPets[i].StableId)+"|"+toString("%d,%d,%d", _PlayerPets[i].Landscape_X, _PlayerPets[i].Landscape_Y, _PlayerPets[i].Landscape_Z)+"|"+toString("%u", timeBeforeDespawn)+"|"+toString("%f/%f", _PlayerPets[i].Satiety, _PlayerPets[i].MaxSatiety)+"|"+toString("%u|%u/%u|%u/%u", slots, bulk, max_bulk, weight, max_weight)+"|"+inBag+"|"+spawnFlag+"|"+name+"\n";
}
return pets;
}
//----------------------------------------------- //-----------------------------------------------
// CCharacter::checkAnimalCount return true if can add 'delta' pets to current player pets // CCharacter::checkAnimalCount return true if can add 'delta' pets to current player pets
@ -6976,7 +7032,7 @@ void CCharacter::removeAnimal(CGameItemPtr item, CPetCommandMsg::TCommand mode)
//----------------------------------------------- //-----------------------------------------------
// remove pet from player corresponding to index and despawn it // remove pet from player corresponding to index and despawn it
//----------------------------------------------- //-----------------------------------------------
void CCharacter::removeAnimalIndex(uint32 beastIndex, CPetCommandMsg::TCommand commande) void CCharacter::removeAnimalIndex(uint32 beastIndex, CPetCommandMsg::TCommand commande, bool keepInventory)
{ {
// make sure the index is in range // make sure the index is in range
BOMB_IF(beastIndex >= _PlayerPets.size(), BOMB_IF(beastIndex >= _PlayerPets.size(),
@ -7041,7 +7097,7 @@ void CCharacter::removeAnimalIndex(uint32 beastIndex, CPetCommandMsg::TCommand c
break; break;
case CPetCommandMsg::LIBERATE: case CPetCommandMsg::LIBERATE:
removePetCharacterAfterDeath((uint16)beastIndex); removePetCharacterAfterDeath((uint16)beastIndex, keepInventory);
break; break;
default: default:
@ -7212,7 +7268,7 @@ void CCharacter::updateAnimalDespawnDb(uint petIndex)
//----------------------------------------------- //-----------------------------------------------
// CCharacter::removePetCharacter Update database for spawned pets // CCharacter::removePetCharacter Update database for spawned pets
//----------------------------------------------- //-----------------------------------------------
void CCharacter::removePetCharacterAfterDeath(uint32 index) void CCharacter::removePetCharacterAfterDeath(uint32 index, bool keepInventory)
{ {
TLogContext_Item_PetDespawn logContext(_Id); TLogContext_Item_PetDespawn logContext(_Id);
@ -7224,7 +7280,7 @@ void CCharacter::removePetCharacterAfterDeath(uint32 index)
CBankAccessor_PLR::getPACK_ANIMAL().getBEAST(index).setDESPAWN(_PropertyDatabase, 0); CBankAccessor_PLR::getPACK_ANIMAL().getBEAST(index).setDESPAWN(_PropertyDatabase, 0);
uint32 packInv = INVENTORIES::pet_animal + index; uint32 packInv = INVENTORIES::pet_animal + index;
if (packInv < INVENTORIES::max_pet_animal) if (!keepInventory && packInv < INVENTORIES::max_pet_animal)
{ {
CInventoryPtr petInv = _Inventory[packInv]; CInventoryPtr petInv = _Inventory[packInv];
@ -7632,6 +7688,12 @@ void CCharacter::sendAnimalCommand(uint8 petIndexCode, uint8 command)
break; break;
case ANIMALS_ORDERS::FREE: case ANIMALS_ORDERS::FREE:
if (!checkPackAnimalEmptyInventory(petIndex))
{
CCharacter::sendDynamicSystemMessage(getId(), "PACK_ANIMAL_INVENTORY_MUST_BE_EMPTY");
continue;
}
if (_PlayerPets[petIndex].IsMounted) if (_PlayerPets[petIndex].IsMounted)
continue; continue;

@ -994,6 +994,9 @@ public:
// return a list of pets in text format (M=Mount, P=Packer, A=Animal, 0=None) // return a list of pets in text format (M=Mount, P=Packer, A=Animal, 0=None)
std::string getPets(); std::string getPets();
// return a list of pets informations (Sheet, Size, State, Position, Volume, Weight)
std::string getPetsInfos();
// return true if can add 'delta' pets to current player pets // return true if can add 'delta' pets to current player pets
bool checkAnimalCount(const NLMISC::CSheetId &PetTicket, bool sendMessage, sint32 delta); bool checkAnimalCount(const NLMISC::CSheetId &PetTicket, bool sendMessage, sint32 delta);
@ -1077,7 +1080,7 @@ public:
void removeAnimal(CGameItemPtr item, CPetCommandMsg::TCommand command); void removeAnimal(CGameItemPtr item, CPetCommandMsg::TCommand command);
// remove pet from player corresponding to index and despawn it // remove pet from player corresponding to index and despawn it
void removeAnimalIndex(uint32 beastIndex, CPetCommandMsg::TCommand command); void removeAnimalIndex(uint32 beastIndex, CPetCommandMsg::TCommand command, bool keepInventory=false);
// update coordinate for spawned pets // update coordinate for spawned pets
void updatePetCoordinateAndDatabase(); void updatePetCoordinateAndDatabase();
@ -1086,7 +1089,7 @@ public:
void updateAnimalDespawnDb(uint petIndex); void updateAnimalDespawnDb(uint petIndex);
// remove Pet Character after his death // remove Pet Character after his death
void removePetCharacterAfterDeath(uint32 index); void removePetCharacterAfterDeath(uint32 index, bool keepInventory = false);
// Update database for spawned pets // Update database for spawned pets
void updatePetDatabase(); void updatePetDatabase();

Loading…
Cancel
Save