diff --git a/changelog.txt b/changelog.txt index 49b57f400..5ebe877f2 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,8 @@ EQEMu Changelog (Started on Sept 24, 2003 15:50) ------------------------------------------------------- +== 07/18/2013 == +KLS: Fix for crash in special_abilities code due to existing use of some dangerous code we didn't catch before. + == 07/15/2013 == Sorvani: fix for lua_general.cpp funtion get_spawn_condition Uleat: added non-extensioned wildcard filter to \\...\dependencies\.gitignore to fix tortoisegit inclusion errors (fixes commit and display overlay issues.) diff --git a/zone/AA.cpp b/zone/AA.cpp index 06e7636e6..24c17b939 100644 --- a/zone/AA.cpp +++ b/zone/AA.cpp @@ -838,50 +838,50 @@ void Mob::WakeTheDead(uint16 spell_id, Mob *target, uint32 duration) break; case PALADIN: //SPECATK_TRIPLE - make_npc->special_abilities = "6,1"; + strcpy(make_npc->special_abilities, "6,1"); make_npc->cur_hp = make_npc->cur_hp * 150 / 100; make_npc->max_hp = make_npc->max_hp * 150 / 100; make_npc->npc_spells_id = 8; break; case SHADOWKNIGHT: - make_npc->special_abilities = "6,1"; + strcpy(make_npc->special_abilities, "6,1"); make_npc->cur_hp = make_npc->cur_hp * 150 / 100; make_npc->max_hp = make_npc->max_hp * 150 / 100; make_npc->npc_spells_id = 9; break; case RANGER: - make_npc->special_abilities = "7,1"; + strcpy(make_npc->special_abilities, "7,1"); make_npc->cur_hp = make_npc->cur_hp * 135 / 100; make_npc->max_hp = make_npc->max_hp * 135 / 100; make_npc->npc_spells_id = 10; break; case BARD: - make_npc->special_abilities = "6,1"; + strcpy(make_npc->special_abilities, "6,1"); make_npc->cur_hp = make_npc->cur_hp * 110 / 100; make_npc->max_hp = make_npc->max_hp * 110 / 100; make_npc->npc_spells_id = 11; break; case BEASTLORD: - make_npc->special_abilities = "7,1"; + strcpy(make_npc->special_abilities, "7,1"); make_npc->cur_hp = make_npc->cur_hp * 110 / 100; make_npc->max_hp = make_npc->max_hp * 110 / 100; make_npc->npc_spells_id = 12; break; case ROGUE: - make_npc->special_abilities = "7,1"; + strcpy(make_npc->special_abilities, "7,1"); make_npc->max_dmg = make_npc->max_dmg * 150 /100; make_npc->cur_hp = make_npc->cur_hp * 110 / 100; make_npc->max_hp = make_npc->max_hp * 110 / 100; break; case MONK: - make_npc->special_abilities = "7,1"; + strcpy(make_npc->special_abilities, "7,1"); make_npc->max_dmg = make_npc->max_dmg * 150 /100; make_npc->cur_hp = make_npc->cur_hp * 135 / 100; make_npc->max_hp = make_npc->max_hp * 135 / 100; break; case WARRIOR: case BERSERKER: - make_npc->special_abilities = "7,1"; + strcpy(make_npc->special_abilities, "7,1"); make_npc->max_dmg = make_npc->max_dmg * 150 /100; make_npc->cur_hp = make_npc->cur_hp * 175 / 100; make_npc->max_hp = make_npc->max_hp * 175 / 100; diff --git a/zone/command.cpp b/zone/command.cpp index 5834d6f9e..259536aac 100644 --- a/zone/command.cpp +++ b/zone/command.cpp @@ -3373,7 +3373,7 @@ void command_viewnpctype(Client *c, const Seperator *sep) c->Message(0, " Class: %i", npct->class_); c->Message(0, " MinDmg: %i", npct->min_dmg); c->Message(0, " MaxDmg: %i", npct->max_dmg); - c->Message(0, " Special Abilities: %s", npct->special_abilities.c_str()); + c->Message(0, " Special Abilities: %s", npct->special_abilities); c->Message(0, " Spells: %i", npct->npc_spells_id); c->Message(0, " Loot Table: %i", npct->loottable_id); c->Message(0, " NPCFactionID: %i", npct->npc_faction_id); diff --git a/zone/horse.cpp b/zone/horse.cpp index 050cc49f7..04c826df0 100644 --- a/zone/horse.cpp +++ b/zone/horse.cpp @@ -87,12 +87,7 @@ const NPCType *Horse::BuildHorseType(uint16 spell_id) { memset(npc_type, 0, sizeof(NPCType)); strcpy(npc_type->name,"Unclaimed_Mount"); //this should never get used - npc_type->special_abilities = itoa(IMMUNE_MELEE); - npc_type->special_abilities += std::string(",1^"); - npc_type->special_abilities += itoa(IMMUNE_MAGIC); - npc_type->special_abilities += std::string(",1^"); - npc_type->special_abilities += itoa(IMMUNE_AGGRO); - npc_type->special_abilities += std::string(",1"); + strcpy(npc_type->special_abilities, "19,1^20,1^24,1"); npc_type->cur_hp = 1; npc_type->max_hp = 1; npc_type->race = atoi(row[0]); diff --git a/zone/merc.cpp b/zone/merc.cpp index bb7b039ef..b0df06e35 100644 --- a/zone/merc.cpp +++ b/zone/merc.cpp @@ -1850,7 +1850,6 @@ void Merc::AI_Start(int32 iMoveDelay) { } if (NPCTypedata_ours) { - //AI_AddNPCSpells(ourNPCData->npc_spells_id); ProcessSpecialAbilities(NPCTypedata_ours->special_abilities); } diff --git a/zone/trap.cpp b/zone/trap.cpp index f631680fb..00ab31bd0 100644 --- a/zone/trap.cpp +++ b/zone/trap.cpp @@ -330,14 +330,7 @@ void Trap::CreateHiddenTrigger() make_npc->d_meele_texture2 = 0; make_npc->trackable = 0; make_npc->level = level; - make_npc->special_abilities = itoa(IMMUNE_MELEE); - make_npc->special_abilities += std::string(",1^"); - make_npc->special_abilities += itoa(IMMUNE_MAGIC); - make_npc->special_abilities += std::string(",1^"); - make_npc->special_abilities += itoa(IMMUNE_AGGRO); - make_npc->special_abilities += std::string(",1^"); - make_npc->special_abilities += itoa(IMMUNE_AGGRO_ON); - make_npc->special_abilities += std::string(",1"); + strcpy(make_npc->special_abilities, "19,1^20,1^24,1^25,1"); NPC* npca = new NPC(make_npc, 0, x, y, z, 0, FlyMode3); npca->GiveNPCTypeData(make_npc); entity_list.AddNPC(npca); diff --git a/zone/zonedb.cpp b/zone/zonedb.cpp index 7014f0791..065a26c99 100644 --- a/zone/zonedb.cpp +++ b/zone/zonedb.cpp @@ -1130,7 +1130,7 @@ const NPCType* ZoneDatabase::GetNPCType (uint32 id) { tmpNPCType->min_dmg = atoi(row[r++]); tmpNPCType->max_dmg = atoi(row[r++]); tmpNPCType->attack_count = atoi(row[r++]); - tmpNPCType->special_abilities = row[r++]; + strn0cpy(tmpNPCType->special_abilities, row[r++], 512); tmpNPCType->npc_spells_id = atoi(row[r++]); tmpNPCType->d_meele_texture1 = atoi(row[r++]); tmpNPCType->d_meele_texture2 = atoi(row[r++]); @@ -1440,7 +1440,7 @@ const NPCType* ZoneDatabase::GetMercType(uint32 id, uint16 raceid, uint32 client tmpNPCType->min_dmg = atoi(row[r++]); tmpNPCType->max_dmg = atoi(row[r++]); tmpNPCType->attack_count = atoi(row[r++]); - tmpNPCType->special_abilities = row[r++]; + strn0cpy(tmpNPCType->special_abilities, row[r++], 512); //tmpNPCType->npc_spells_id = atoi(row[r++]); tmpNPCType->d_meele_texture1 = atoi(row[r++]); tmpNPCType->d_meele_texture2 = atoi(row[r++]); diff --git a/zone/zonedump.h b/zone/zonedump.h index 99ca61d50..60333515a 100644 --- a/zone/zonedump.h +++ b/zone/zonedump.h @@ -89,7 +89,7 @@ struct NPCType uint32 min_dmg; uint32 max_dmg; int16 attack_count; - std::string special_abilities; + char special_abilities[512]; uint16 d_meele_texture1; uint16 d_meele_texture2; uint8 prim_melee_type;