Skip to content

Commit

Permalink
Bot saylinks and command aliases.
Browse files Browse the repository at this point in the history
  • Loading branch information
Kinglykrab committed Jul 6, 2015
1 parent 1d29c87 commit e2ac647
Show file tree
Hide file tree
Showing 12 changed files with 222 additions and 311 deletions.
6 changes: 6 additions & 0 deletions changelog.txt
Expand Up @@ -8,6 +8,12 @@ mackal: Rewrite NPC combat attack round logic
See: http://www.eqemulator.org/forums/showthread.php?t=38708
You can set Combat:UseLiveCombatRounds to false to use the old rules
PC Double Attack rates kind of follow the same thing but still needs to be implemented
Kinglykrab: WARNING: summonburriedplayercorpse is now summonburiedplayercorpse, getplayerburriedcorpsecount is now getplayerburiedcorpsecount, summon_burried_player_corpse is now summon_buried_player_corpse, and get_player_burried_corpse_count is now get_player_buried_corpse_count FIX THESE IN YOUR SCRIPTS OR THEY WILL NOT WORK!!!!
Added bot saylinks (thanks Uleat!)
Command aliases for #augmentitem (#aug), #findnpctype (#fn), #findspell (#fs)
Bot command changes: #bot sow -> #bot speed, #bot magepet -> #bot setpet, #bot resurrectme -> #bot resurrect
Changed all occurrences of burried to buried in the code.
client_packet.cpp was referencing old columns in character_corpses, not sure how we didn't already see this before.

== 7/4/2015 ==
mackal: Reworked the activated avoidace skills (riposte, dodge, etc) based on dev quotes
Expand Down
2 changes: 2 additions & 0 deletions common/ruletypes.h
Expand Up @@ -506,6 +506,8 @@ RULE_INT(Bots, BotAAExpansion, 8) // Bots get AAs through this expansion
RULE_BOOL(Bots, BotGroupXP, false) // Determines whether client gets xp for bots outside their group.
RULE_BOOL(Bots, BotBardUseOutOfCombatSongs, true) // Determines whether bard bots use additional out of combat songs.
RULE_BOOL(Bots, BotLevelsWithOwner, false) // Auto-updates spawned bots as owner levels/de-levels (false is original behavior)
RULE_BOOL(Bots, BotCharacterLevelEnabled, false) // Enables required level to spawn bots
RULE_INT(Bots, BotCharacterLevel, 0) // 0 as default (if level > this value you can spawn bots if BotCharacterLevelEnabled is true)
RULE_CATEGORY_END()
#endif

Expand Down
456 changes: 177 additions & 279 deletions zone/bot.cpp

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions zone/bot.h
Expand Up @@ -549,6 +549,8 @@ class Bot : public NPC {
void SetNumHealRotationMembers( uint8 numMembers ) { _numHealRotationMembers = numMembers; }
void SetBardUseOutOfCombatSongs(bool useOutOfCombatSongs) { _bardUseOutOfCombatSongs = useOutOfCombatSongs;}
void SetShowHelm(bool showhelm) { _showhelm = showhelm; }

std::string CreateSayLink(Client* botOwner, const char* message, const char* name);

// Class Destructors
virtual ~Bot();
Expand Down
2 changes: 1 addition & 1 deletion zone/client_packet.cpp
Expand Up @@ -6008,7 +6008,7 @@ void Client::Handle_OP_GMSearchCorpse(const EQApplicationPacket *app)
char *escSearchString = new char[129];
database.DoEscapeString(escSearchString, gmscs->Name, strlen(gmscs->Name));

std::string query = StringFormat("SELECT charname, zoneid, x, y, z, time_of_death, rezzed, IsBurried "
std::string query = StringFormat("SELECT charname, zoneid, x, y, z, time_of_death, is_rezzed, is_buried "
"FROM character_corpses WheRE charname LIKE '%%%s%%' ORDER BY charname LIMIT %i",
escSearchString, maxResults);
safe_delete_array(escSearchString);
Expand Down
19 changes: 11 additions & 8 deletions zone/command.cpp
Expand Up @@ -170,6 +170,7 @@ int command_init(void) {
command_add("appearance", "[type] [value] - Send an appearance packet for you or your target", 150, command_appearance) ||
command_add("attack", "[targetname] - Make your NPC target attack targetname", 150, command_attack) ||
command_add("augmentitem", "Force augments an item. Must have the augment item window open.", 250, command_augmentitem) ||
command_add("aug", nullptr, 250, command_augmentitem) ||
command_add("ban", "[name] [reason]- Ban by character name", 150, command_ban) ||
command_add("beard", "- Change the beard of your target", 80, command_beard) ||
command_add("beardcolor", "- Change the beard color of your target", 80, command_beardcolor) ||
Expand Down Expand Up @@ -216,12 +217,14 @@ int command_init(void) {
command_add("flagedit", "- Edit zone flags on your target", 100, command_flagedit) ||
command_add("flags", "- displays the flags of you or your target", 0, command_flags) ||
command_add("flymode", "[0/1/2] - Set your or your player target's flymode to off/on/levitate", 50, command_flymode) ||
command_add("fn", nullptr, 100, command_findnpctype) ||
command_add("fov", "- Check wether you're behind or in your target's field of view", 80, command_fov) ||
command_add("freeze", "- Freeze your target", 80, command_freeze) ||
command_add("fz", nullptr, 10, command_findzone) ||
command_add("fs", nullptr, 50, command_findspell) ||
command_add("fz", nullptr, 100, command_findzone) ||
command_add("gassign", "[id] - Assign targetted NPC to predefined wandering grid id", 100, command_gassign) ||
command_add("gender", "[0/1/2] - Change your or your target's gender to male/female/neuter", 50, command_gender) ||
command_add("getplayerburriedcorpsecount", "- Get the target's total number of burried player corpses.", 100, command_getplayerburriedcorpsecount) ||
command_add("getplayerburiedcorpsecount", "- Get the target's total number of buried player corpses.", 100, command_getplayerburiedcorpsecount) ||
command_add("getvariable", "[varname] - Get the value of a variable from the database", 200, command_getvariable) ||
command_add("gi", nullptr,200, command_giveitem) ||
command_add("ginfo", "- get group info on target.", 20, command_ginfo) ||
Expand Down Expand Up @@ -386,7 +389,7 @@ int command_init(void) {
command_add("spon", "- Sends OP_MemorizeSpell", 80, command_spon) ||
command_add("stun", "[duration] - Stuns you or your target for duration", 100, command_stun) ||
command_add("summon", "[charname] - Summons your player/npc/corpse target, or charname if specified", 80, command_summon) ||
command_add("summonburriedplayercorpse", "- Summons the target's oldest burried corpse, if any exist.", 100, command_summonburriedplayercorpse) ||
command_add("summonburiedplayercorpse", "- Summons the target's oldest buried corpse, if any exist.", 100, command_summonburiedplayercorpse) ||
command_add("summonitem", "[itemid] [charges] - Summon an item onto your cursor. Charges are optional.", 200, command_summonitem) ||
command_add("suspend", "[name] [days] [reason] - Suspend by character name and for specificed number of days", 150, command_suspend) ||
command_add("task", "(subcommand) - Task system commands", 150, command_task) ||
Expand Down Expand Up @@ -7801,7 +7804,7 @@ void command_deletegraveyard(Client *c, const Seperator *sep)
return;
}

void command_summonburriedplayercorpse(Client *c, const Seperator *sep)
void command_summonburiedplayercorpse(Client *c, const Seperator *sep)
{
Client *t=c;

Expand All @@ -7815,12 +7818,12 @@ void command_summonburriedplayercorpse(Client *c, const Seperator *sep)
Corpse* PlayerCorpse = database.SummonBuriedCharacterCorpses(t->CharacterID(), t->GetZoneID(), zone->GetInstanceID(), t->GetPosition());

if(!PlayerCorpse)
c->Message(0, "Your target doesn't have any burried corpses.");
c->Message(0, "Your target doesn't have any buried corpses.");

return;
}

void command_getplayerburriedcorpsecount(Client *c, const Seperator *sep)
void command_getplayerburiedcorpsecount(Client *c, const Seperator *sep)
{
Client *t=c;

Expand All @@ -7834,9 +7837,9 @@ void command_getplayerburriedcorpsecount(Client *c, const Seperator *sep)
uint32 CorpseCount = database.GetCharacterBuriedCorpseCount(t->CharacterID());

if(CorpseCount > 0)
c->Message(0, "Your target has a total of %u burried corpses.", CorpseCount);
c->Message(0, "Your target has a total of %u buried corpses.", CorpseCount);
else
c->Message(0, "Your target doesn't have any burried corpses.");
c->Message(0, "Your target doesn't have any buried corpses.");

return;
}
Expand Down
4 changes: 2 additions & 2 deletions zone/command.h
Expand Up @@ -279,8 +279,8 @@ void command_refundaa(Client *c, const Seperator *sep);
void command_traindisc(Client *c, const Seperator *sep);
void command_deletegraveyard(Client *c, const Seperator *sep);
void command_setgraveyard(Client *c, const Seperator *sep);
void command_getplayerburriedcorpsecount(Client *c, const Seperator *sep);
void command_summonburriedplayercorpse(Client *c, const Seperator *sep);
void command_getplayerburiedcorpsecount(Client *c, const Seperator *sep);
void command_summonburiedplayercorpse(Client *c, const Seperator *sep);
void command_unscribespell(Client *c, const Seperator *sep);
void command_scribespell(Client *c, const Seperator *sep);
void command_refreshgroup(Client *c, const Seperator *sep);
Expand Down
2 changes: 1 addition & 1 deletion zone/corpse.cpp
Expand Up @@ -835,7 +835,7 @@ bool Corpse::Process() {
Save();
player_corpse_depop = true;
corpse_db_id = 0;
Log.Out(Logs::General, Logs::None, "Tagged %s player corpse has burried.", this->GetName());
Log.Out(Logs::General, Logs::None, "Tagged %s player corpse has buried.", this->GetName());
}
else {
Log.Out(Logs::General, Logs::Error, "Unable to bury %s player corpse.", this->GetName());
Expand Down
20 changes: 10 additions & 10 deletions zone/embparser_api.cpp
Expand Up @@ -1748,18 +1748,18 @@ XS(XS__clear_zone_flag)
XSRETURN_EMPTY;
}

XS(XS__summonburriedplayercorpse);
XS(XS__summonburriedplayercorpse)
XS(XS__summonburiedplayercorpse);
XS(XS__summonburiedplayercorpse)
{
dXSARGS;
if (items != 5)
Perl_croak(aTHX_ "Usage: summonburriedplayercorpse(char_id,dest_x,dest_y,dest_z,dest_heading)");
Perl_croak(aTHX_ "Usage: summonburiedplayercorpse(char_id,dest_x,dest_y,dest_z,dest_heading)");

bool RETVAL;
uint32 char_id = (int)SvIV(ST(0));
auto position = glm::vec4((float)SvIV(ST(1)), (float)SvIV(ST(2)), (float)SvIV(ST(3)),(float)SvIV(ST(4)));

RETVAL = quest_manager.summonburriedplayercorpse(char_id, position);
RETVAL = quest_manager.summonburiedplayercorpse(char_id, position);

ST(0) = boolSV(RETVAL);
sv_2mortal(ST(0));
Expand All @@ -1784,19 +1784,19 @@ XS(XS__summonallplayercorpses)
XSRETURN(1);
}

XS(XS__getplayerburriedcorpsecount);
XS(XS__getplayerburriedcorpsecount)
XS(XS__getplayerburiedcorpsecount);
XS(XS__getplayerburiedcorpsecount)
{
dXSARGS;
if (items != 1)
Perl_croak(aTHX_ "Usage: getplayerburriedcorpsecount(char_id)");
Perl_croak(aTHX_ "Usage: getplayerburiedcorpsecount(char_id)");

uint32 RETVAL;
dXSTARG;

uint32 char_id = (int)SvIV(ST(0));

RETVAL = quest_manager.getplayerburriedcorpsecount(char_id);
RETVAL = quest_manager.getplayerburiedcorpsecount(char_id);
XSprePUSH; PUSHu((IV)RETVAL);

XSRETURN(1);
Expand Down Expand Up @@ -3712,7 +3712,7 @@ EXTERN_C XS(boot_quest)
newXS(strcpy(buf, "get_spawn_condition"), XS__get_spawn_condition, file);
newXS(strcpy(buf, "getguildnamebyid"), XS__getguildnamebyid, file);
newXS(strcpy(buf, "getlevel"), XS__getlevel, file);
newXS(strcpy(buf, "getplayerburriedcorpsecount"), XS__getplayerburriedcorpsecount, file);
newXS(strcpy(buf, "getplayerburiedcorpsecount"), XS__getplayerburiedcorpsecount, file);
newXS(strcpy(buf, "gettaskactivitydonecount"), XS__gettaskactivitydonecount, file);
newXS(strcpy(buf, "givecash"), XS__givecash, file);
newXS(strcpy(buf, "gmmove"), XS__gmmove, file);
Expand Down Expand Up @@ -3802,7 +3802,7 @@ EXTERN_C XS(boot_quest)
newXS(strcpy(buf, "stopalltimers"), XS__stopalltimers, file);
newXS(strcpy(buf, "stoptimer"), XS__stoptimer, file);
newXS(strcpy(buf, "summonallplayercorpses"), XS__summonallplayercorpses, file);
newXS(strcpy(buf, "summonburriedplayercorpse"), XS__summonburriedplayercorpse, file);
newXS(strcpy(buf, "summonburiedplayercorpse"), XS__summonburiedplayercorpse, file);
newXS(strcpy(buf, "summonitem"), XS__summonitem, file);
newXS(strcpy(buf, "surname"), XS__surname, file);
newXS(strcpy(buf, "targlobal"), XS__targlobal, file);
Expand Down
12 changes: 6 additions & 6 deletions zone/lua_general.cpp
Expand Up @@ -513,16 +513,16 @@ void lua_toggle_spawn_event(int event_id, bool enable, bool strict, bool reset)
quest_manager.toggle_spawn_event(event_id, enable, strict, reset);
}

void lua_summon_burried_player_corpse(uint32 char_id, float x, float y, float z, float h) {
quest_manager.summonburriedplayercorpse(char_id, glm::vec4(x, y, z, h));
void lua_summon_buried_player_corpse(uint32 char_id, float x, float y, float z, float h) {
quest_manager.summonburiedplayercorpse(char_id, glm::vec4(x, y, z, h));
}

void lua_summon_all_player_corpses(uint32 char_id, float x, float y, float z, float h) {
quest_manager.summonallplayercorpses(char_id, glm::vec4(x, y, z, h));
}

int lua_get_player_burried_corpse_count(uint32 char_id) {
return quest_manager.getplayerburriedcorpsecount(char_id);
int lua_get_player_buried_corpse_count(uint32 char_id) {
return quest_manager.getplayerburiedcorpsecount(char_id);
}

bool lua_bury_player_corpse(uint32 char_id) {
Expand Down Expand Up @@ -1524,9 +1524,9 @@ luabind::scope lua_register_general() {
luabind::def("spawn_condition", &lua_spawn_condition),
luabind::def("get_spawn_condition", &lua_get_spawn_condition),
luabind::def("toggle_spawn_event", &lua_toggle_spawn_event),
luabind::def("summon_burried_player_corpse", &lua_summon_burried_player_corpse),
luabind::def("summon_buried_player_corpse", &lua_summon_buried_player_corpse),
luabind::def("summon_all_player_corpses", &lua_summon_all_player_corpses),
luabind::def("get_player_burried_corpse_count", &lua_get_player_burried_corpse_count),
luabind::def("get_player_buried_corpse_count", &lua_get_player_buried_corpse_count),
luabind::def("bury_player_corpse", &lua_bury_player_corpse),
luabind::def("task_selector", &lua_task_selector),
luabind::def("task_set_selector", &lua_task_set_selector),
Expand Down
4 changes: 2 additions & 2 deletions zone/questmgr.cpp
Expand Up @@ -1774,7 +1774,7 @@ void QuestManager::sethp(int hpperc) {
owner->Damage(owner, newhp, SPELL_UNKNOWN, SkillHandtoHand, false, 0, false);
}

bool QuestManager::summonburriedplayercorpse(uint32 char_id, const glm::vec4& position) {
bool QuestManager::summonburiedplayercorpse(uint32 char_id, const glm::vec4& position) {
bool Result = false;

if(char_id <= 0)
Expand All @@ -1798,7 +1798,7 @@ bool QuestManager::summonallplayercorpses(uint32 char_id, const glm::vec4& posit
return true;
}

uint32 QuestManager::getplayerburriedcorpsecount(uint32 char_id) {
uint32 QuestManager::getplayerburiedcorpsecount(uint32 char_id) {
uint32 Result = 0;

if(char_id > 0) {
Expand Down
4 changes: 2 additions & 2 deletions zone/questmgr.h
Expand Up @@ -159,9 +159,9 @@ class QuestManager {
void set_zone_flag(int zone_id);
void clear_zone_flag(int zone_id);
void sethp(int hpperc);
bool summonburriedplayercorpse(uint32 char_id, const glm::vec4& position);
bool summonburiedplayercorpse(uint32 char_id, const glm::vec4& position);
bool summonallplayercorpses(uint32 char_id, const glm::vec4& position);
uint32 getplayerburriedcorpsecount(uint32 char_id);
uint32 getplayerburiedcorpsecount(uint32 char_id);
bool buryplayercorpse(uint32 char_id);
void forcedooropen(uint32 doorid, bool altmode);
void forcedoorclose(uint32 doorid, bool altmode);
Expand Down

0 comments on commit e2ac647

Please sign in to comment.