|
@@ -3778,18 +3778,18 @@ bool CGameHandler::makeBattleAction( BattleAction &ba )
|
|
|
return ok;
|
|
|
}
|
|
|
|
|
|
-void CGameHandler::playerMessage( PlayerColor player, const std::string &message )
|
|
|
+void CGameHandler::playerMessage( PlayerColor player, const std::string &message, ObjectInstanceID currObj )
|
|
|
{
|
|
|
bool cheated=true;
|
|
|
- PlayerMessage temp_message(player, message);
|
|
|
+ PlayerMessage temp_message(player, message, ObjectInstanceID(-1)); // don't inform other client on selected object
|
|
|
|
|
|
sendAndApply(&temp_message);
|
|
|
if(message == "vcmiistari") //give all spells and 999 mana
|
|
|
- {/*
|
|
|
+ {
|
|
|
SetMana sm;
|
|
|
ChangeSpells cs;
|
|
|
|
|
|
- CGHeroInstance *h = gs->getHero(gs->getPlayer(player)->currentSelection);
|
|
|
+ CGHeroInstance *h = gs->getHero(currObj);
|
|
|
if(!h && complain("Cannot realize cheat, no hero selected!")) return;
|
|
|
|
|
|
sm.hid = cs.hid = h->id;
|
|
@@ -3813,13 +3813,13 @@ void CGameHandler::playerMessage( PlayerColor player, const std::string &message
|
|
|
}
|
|
|
else if (message == "vcmiarmenelos") //build all buildings in selected town
|
|
|
{
|
|
|
- CGHeroInstance *hero = gs->getHero(gs->getPlayer(player)->currentSelection);
|
|
|
+ CGHeroInstance *hero = gs->getHero(currObj);
|
|
|
CGTownInstance *town;
|
|
|
|
|
|
if (hero)
|
|
|
town = hero->visitedTown;
|
|
|
else
|
|
|
- town = gs->getTown(gs->getPlayer(player)->currentSelection);
|
|
|
+ town = gs->getTown(currObj);
|
|
|
|
|
|
if (town)
|
|
|
{
|
|
@@ -3836,7 +3836,7 @@ void CGameHandler::playerMessage( PlayerColor player, const std::string &message
|
|
|
}
|
|
|
else if(message == "vcmiainur") //gives 5 archangels into each slot
|
|
|
{
|
|
|
- CGHeroInstance *hero = gs->getHero(gs->getPlayer(player)->currentSelection);
|
|
|
+ CGHeroInstance *hero = gs->getHero(currObj);
|
|
|
const CCreature *archangel = VLC->creh->creatures.at(13);
|
|
|
if(!hero) return;
|
|
|
|
|
@@ -3846,7 +3846,7 @@ void CGameHandler::playerMessage( PlayerColor player, const std::string &message
|
|
|
}
|
|
|
else if(message == "vcmiangband") //gives 10 black knight into each slot
|
|
|
{
|
|
|
- CGHeroInstance *hero = gs->getHero(gs->getPlayer(player)->currentSelection);
|
|
|
+ CGHeroInstance *hero = gs->getHero(currObj);
|
|
|
const CCreature *blackKnight = VLC->creh->creatures.at(66);
|
|
|
if(!hero) return;
|
|
|
|
|
@@ -3856,7 +3856,7 @@ void CGameHandler::playerMessage( PlayerColor player, const std::string &message
|
|
|
}
|
|
|
else if(message == "vcminoldor") //all war machines
|
|
|
{
|
|
|
- CGHeroInstance *hero = gs->getHero(gs->getPlayer(player)->currentSelection);
|
|
|
+ CGHeroInstance *hero = gs->getHero(currObj);
|
|
|
if(!hero) return;
|
|
|
|
|
|
if(!hero->getArt(ArtifactPosition::MACH1))
|
|
@@ -3868,24 +3868,24 @@ void CGameHandler::playerMessage( PlayerColor player, const std::string &message
|
|
|
}
|
|
|
else if (message == "vcmiforgeofnoldorking") //hero gets all artifacts except war machines, spell scrolls and spell book
|
|
|
{
|
|
|
- CGHeroInstance *hero = gs->getHero(gs->getPlayer(player)->currentSelection);
|
|
|
+ CGHeroInstance *hero = gs->getHero(currObj);
|
|
|
if(!hero) return;
|
|
|
for (int g = 7; g < VLC->arth->artifacts.size(); ++g) //including artifacts from mods
|
|
|
giveHeroNewArtifact(hero, VLC->arth->artifacts.at(g), ArtifactPosition::PRE_FIRST);
|
|
|
}
|
|
|
else if(message == "vcmiglorfindel") //selected hero gains a new level
|
|
|
{
|
|
|
- CGHeroInstance *hero = gs->getHero(gs->getPlayer(player)->currentSelection);
|
|
|
+ CGHeroInstance *hero = gs->getHero(currObj);
|
|
|
changePrimSkill(hero, PrimarySkill::EXPERIENCE, VLC->heroh->reqExp(hero->level+1) - VLC->heroh->reqExp(hero->level));
|
|
|
}
|
|
|
else if(message == "vcminahar") //1000000 movement points
|
|
|
{
|
|
|
- CGHeroInstance *hero = gs->getHero(gs->getPlayer(player)->currentSelection);
|
|
|
+ CGHeroInstance *hero = gs->getHero(currObj);
|
|
|
if(!hero) return;
|
|
|
SetMovePoints smp;
|
|
|
smp.hid = hero->id;
|
|
|
smp.val = 1000000;
|
|
|
- sendAndApply(&smp);*/
|
|
|
+ sendAndApply(&smp);
|
|
|
}
|
|
|
else if(message == "vcmiformenos") //give resources
|
|
|
{
|