std::map<std::string,std::string> EQW::GetPlayerDetails(Const_char *char_name) { std::map<std::string,std::string> res; ClientListEntry *cle = client_list.FindCharacter(char_name); if(cle == nullptr) { res["error"] = "1"; return(res); } res["character"] = cle->name(); res["account"] = cle->AccountName(); res["account_id"] = itoa(cle->AccountID()); res["location_short"] = cle->zone()?database.GetZoneName(cle->zone()):"No Zone"; res["location_long"] = res["location_short"]; res["location_id"] = itoa(cle->zone()); res["ip"] = long2ip(cle->GetIP()); res["level"] = itoa(cle->level()); res["race"] = GetRaceName(cle->race()); res["race_id"] = itoa(cle->race()); res["class"] = GetEQClassName(cle->class_()); res["class_id"] = itoa(cle->class_()); res["guild_id"] = itoa(cle->GuildID()); res["guild"] = guild_mgr.GetGuildName(cle->GuildID()); res["status"] = itoa(cle->Admin()); // res["patch"] = cle->DescribePatch(); return(res); }
bool Client::HandleNameApprovalPacket(const EQApplicationPacket *app) { if (GetAccountID() == 0) { clog(WORLD__CLIENT_ERR,"Name approval request with no logged in account"); return false; } snprintf(char_name, 64, "%s", (char*)app->pBuffer); uchar race = app->pBuffer[64]; uchar clas = app->pBuffer[68]; clog(WORLD__CLIENT, "Name approval request. Name=%s, race=%s, class=%s", char_name, GetRaceName(race), GetEQClassName(clas)); EQApplicationPacket *outapp; outapp = new EQApplicationPacket; outapp->SetOpcode(OP_ApproveName); outapp->pBuffer = new uchar[1]; outapp->size = 1; clog(WORLD__CLIENT, "common/client.cpp line 292 pass"); bool valid = false; if (!database.CheckNameFilter(char_name)) { clog(WORLD__CLIENT, "Invalid name"); valid = false; } /* Name must begin with an upper-case letter. */ else if (islower(char_name[0])) { clog(WORLD__CLIENT, "Must begin with uppercase"); valid = false; } else if (database.ReserveName(GetAccountID(), char_name)) { clog(WORLD__CLIENT, "common/client.cpp line 304 pass"); valid = true; } else { clog(WORLD__CLIENT, "common/client.cpp line 308 pass"); valid = false; } clog(WORLD__CLIENT, "common/client.cpp line 312 pass"); outapp->pBuffer[0] = valid? 1 : 0; QueuePacket(outapp); safe_delete(outapp); clog(WORLD__CLIENT, "common/client.cpp line 316 pass"); if (!valid) memset(char_name, 0, sizeof(char_name)); clog(WORLD__CLIENT, "common/client.cpp line 320 pass"); return true; }
void PerlembParser::ExportMobVariables(bool isPlayerQuest, bool isGlobalPlayerQuest, bool isGlobalNPC, bool isItemQuest, bool isSpellQuest, std::string &package_name, Mob *mob, NPC *npcmob) { uint8 fac = 0; if (mob && mob->IsClient()) { ExportVar(package_name.c_str(), "uguild_id", mob->CastToClient()->GuildID()); ExportVar(package_name.c_str(), "uguildrank", mob->CastToClient()->GuildRank()); ExportVar(package_name.c_str(), "status", mob->CastToClient()->Admin()); } if(!isPlayerQuest && !isGlobalPlayerQuest && !isItemQuest) { if (mob && npcmob && mob->IsClient()) { Client* client = mob->CastToClient(); fac = client->GetFactionLevel(client->CharacterID(), npcmob->GetID(), client->GetRace(), client->GetClass(), client->GetDeity(), npcmob->GetPrimaryFaction(), npcmob); } } if(mob) { ExportVar(package_name.c_str(), "name", mob->GetName()); ExportVar(package_name.c_str(), "race", GetRaceName(mob->GetRace())); ExportVar(package_name.c_str(), "class", GetEQClassName(mob->GetClass())); ExportVar(package_name.c_str(), "ulevel", mob->GetLevel()); ExportVar(package_name.c_str(), "userid", mob->GetID()); } if(!isPlayerQuest && !isGlobalPlayerQuest && !isItemQuest && !isSpellQuest) { if (npcmob) { ExportVar(package_name.c_str(), "mname", npcmob->GetName()); ExportVar(package_name.c_str(), "mobid", npcmob->GetID()); ExportVar(package_name.c_str(), "mlevel", npcmob->GetLevel()); ExportVar(package_name.c_str(), "hpratio",npcmob->GetHPRatio()); ExportVar(package_name.c_str(), "x", npcmob->GetX() ); ExportVar(package_name.c_str(), "y", npcmob->GetY() ); ExportVar(package_name.c_str(), "z", npcmob->GetZ() ); ExportVar(package_name.c_str(), "h", npcmob->GetHeading() ); if(npcmob->GetTarget()) { ExportVar(package_name.c_str(), "targetid", npcmob->GetTarget()->GetID()); ExportVar(package_name.c_str(), "targetname", npcmob->GetTarget()->GetName()); } } if (fac) { ExportVar(package_name.c_str(), "faction", itoa(fac)); } } }
bool Client::HandleNameApprovalPacket(const EQApplicationPacket *app) { if (GetAccountID() == 0) { clog(WORLD__CLIENT_ERR,"Name approval request with no logged in account"); return false; } snprintf(char_name, 64, "%s", (char*)app->pBuffer); uchar race = app->pBuffer[64]; uchar clas = app->pBuffer[68]; clog(WORLD__CLIENT,"Name approval request. Name=%s, race=%s, class=%s",char_name,GetRaceName(race),GetEQClassName(clas)); EQApplicationPacket *outapp; outapp = new EQApplicationPacket; outapp->SetOpcode(OP_ApproveName); outapp->pBuffer = new uchar[1]; outapp->size = 1; bool valid; if(!database.CheckNameFilter(char_name)) { valid = false; } else if(char_name[0] < 'A' && char_name[0] > 'Z') { //name must begin with an upper-case letter. valid = false; } else if (database.ReserveName(GetAccountID(), char_name)) { valid = true; } else { valid = false; } outapp->pBuffer[0] = valid? 1 : 0; QueuePacket(outapp); safe_delete(outapp); if(!valid) { memset(char_name, 0, sizeof(char_name)); } return true; }
void ClientList::ConsoleSendWhoAll(const char* to, int16 admin, Who_All_Struct* whom, WorldTCPConnection* connection) { LinkedListIterator<ClientListEntry*> iterator(clientlist); ClientListEntry* cle = 0; char tmpgm[25] = ""; char accinfo[150] = ""; char line[300] = ""; char tmpguild[50] = ""; char LFG[10] = ""; uint32 x = 0; int whomlen = 0; if (whom) whomlen = strlen(whom->whom); char* output = 0; uint32 outsize = 0, outlen = 0; AppendAnyLenString(&output, &outsize, &outlen, "Players on server:"); if (connection->IsConsole()) AppendAnyLenString(&output, &outsize, &outlen, "\r\n"); else AppendAnyLenString(&output, &outsize, &outlen, "\n"); iterator.Reset(); while(iterator.MoreElements()) { cle = iterator.GetData(); const char* tmpZone = database.GetZoneName(cle->zone()); if ( (cle->Online() >= CLE_Status_Zoning) && (whom == 0 || ( ((cle->Admin() >= 80 && cle->GetGM()) || whom->gmlookup == 0xFFFF) && (whom->lvllow == 0xFFFF || (cle->level() >= whom->lvllow && cle->level() <= whom->lvlhigh)) && (whom->wclass == 0xFFFF || cle->class_() == whom->wclass) && (whom->wrace == 0xFFFF || cle->race() == whom->wrace) && (whomlen == 0 || ( (tmpZone != 0 && strncasecmp(tmpZone, whom->whom, whomlen) == 0) || strncasecmp(cle->name(),whom->whom, whomlen) == 0 || (strncasecmp(guild_mgr.GetGuildName(cle->GuildID()), whom->whom, whomlen) == 0) || (admin >= 100 && strncasecmp(cle->AccountName(), whom->whom, whomlen) == 0) )) )) ) { line[0] = 0; // MYRA - use new (5.x) Status labels in who for telnet connection if (cle->Admin() >=250) strcpy(tmpgm, "* GM-Impossible * "); else if (cle->Admin() >= 200) strcpy(tmpgm, "* GM-Mgmt * "); else if (cle->Admin() >= 180) strcpy(tmpgm, "* GM-Coder * "); else if (cle->Admin() >= 170) strcpy(tmpgm, "* GM-Areas * "); else if (cle->Admin() >= 160) strcpy(tmpgm, "* QuestMaster * "); else if (cle->Admin() >= 150) strcpy(tmpgm, "* GM-Lead Admin * "); else if (cle->Admin() >= 100) strcpy(tmpgm, "* GM-Admin * "); else if (cle->Admin() >= 95) strcpy(tmpgm, "* GM-Staff * "); else if (cle->Admin() >= 90) strcpy(tmpgm, "* EQ Support * "); else if (cle->Admin() >= 85) strcpy(tmpgm, "* GM-Tester * "); else if (cle->Admin() >= 81) strcpy(tmpgm, "* Senior Guide * "); else if (cle->Admin() >= 80) strcpy(tmpgm, "* QuestTroupe * "); else if (cle->Admin() >= 50) strcpy(tmpgm, "* Guide * "); else if (cle->Admin() >= 20) strcpy(tmpgm, "* Apprentice Guide * "); else if (cle->Admin() >= 10) strcpy(tmpgm, "* Steward * "); else tmpgm[0] = 0; // end Myra if (guild_mgr.GuildExists(cle->GuildID())) { snprintf(tmpguild, 36, " <%s>", guild_mgr.GetGuildName(cle->GuildID())); } else tmpguild[0] = 0; if (cle->LFG()) strcpy(LFG, " LFG"); else LFG[0] = 0; if (admin >= 150 && admin >= cle->Admin()) { sprintf(accinfo, " AccID: %i AccName: %s LSID: %i Status: %i", cle->AccountID(), cle->AccountName(), cle->LSAccountID(), cle->Admin()); } else accinfo[0] = 0; if (cle->Anon() == 2) { // Roleplay if (admin >= 100 && admin >= cle->Admin()) sprintf(line, " %s[RolePlay %i %s] %s (%s)%s zone: %s%s%s", tmpgm, cle->level(), GetEQClassName(cle->class_(),cle->level()), cle->name(), GetRaceName(cle->race()), tmpguild, tmpZone, LFG, accinfo); else if (cle->Admin() >= 80 && admin < 80 && cle->GetGM()) { iterator.Advance(); continue; } else sprintf(line, " %s[ANONYMOUS] %s%s%s%s", tmpgm, cle->name(), tmpguild, LFG, accinfo); } else if (cle->Anon() == 1) { // Anon if (admin >= 100 && admin >= cle->Admin()) sprintf(line, " %s[ANON %i %s] %s (%s)%s zone: %s%s%s", tmpgm, cle->level(), GetEQClassName(cle->class_(),cle->level()), cle->name(), GetRaceName(cle->race()), tmpguild, tmpZone, LFG, accinfo); else if (cle->Admin() >= 80 && cle->GetGM()) { iterator.Advance(); continue; } else sprintf(line, " %s[ANONYMOUS] %s%s%s", tmpgm, cle->name(), LFG, accinfo); } else sprintf(line, " %s[%i %s] %s (%s)%s zone: %s%s%s", tmpgm, cle->level(), GetEQClassName(cle->class_(),cle->level()), cle->name(), GetRaceName(cle->race()), tmpguild, tmpZone, LFG, accinfo); AppendAnyLenString(&output, &outsize, &outlen, line); if (outlen >= 3584) { connection->SendEmoteMessageRaw(to, 0, 0, 10, output); safe_delete(output); outsize = 0; outlen = 0; } else { if (connection->IsConsole()) AppendAnyLenString(&output, &outsize, &outlen, "\r\n"); else AppendAnyLenString(&output, &outsize, &outlen, "\n"); } x++; if (x >= 20 && admin < 80) break; } iterator.Advance(); } if (x >= 20 && admin < 80) AppendAnyLenString(&output, &outsize, &outlen, "too many results...20 players shown"); else AppendAnyLenString(&output, &outsize, &outlen, "%i players online", x); if (admin >= 150 && (whom == 0 || whom->gmlookup != 0xFFFF)) { if (connection->IsConsole()) AppendAnyLenString(&output, &outsize, &outlen, "\r\n"); else AppendAnyLenString(&output, &outsize, &outlen, "\n"); console_list.SendConsoleWho(connection, to, admin, &output, &outsize, &outlen); } if (output) connection->SendEmoteMessageRaw(to, 0, 0, 10, output); safe_delete(output); }
void Client::CheckQuests(const char* zonename, const char * message, int32 npc_id, uint16 item_id, Mob* other) { bool ps = false; bool tt = false; bool ti = false; bool tt2 = false; bool ti2 = false; bool stt = false; bool std = false; bool td = false; bool sta = false; bool ta = false; bool sti = false; bool stf = false; bool tf = false; bool tk = false; bool stk = false; bool levelcheck = false; int8 fac = GetFactionLevel(GetID(),other->GetNPCTypeID(), GetRace(), GetClass(), DEITY_AGNOSTIC, other->CastToNPC()->GetPrimaryFaction(), other); FILE * pFile; long lSize; char * buffer; char filename[255]; #ifdef WIN32 snprintf(filename, 254, "quests\\%i.qst", npc_id); #else snprintf(filename, 254, "quests/%i.qst", npc_id); #endif adverrorinfo = 940; if ((pFile=fopen(filename,"rb"))) { #ifdef DEBUG printf("Reading quests from %s\n", filename); #endif } else { #ifdef DEBUG printf("Error: No quests file found for %s\n", filename); #endif return; } if (pFile==NULL) exit (1); // obtain file size. fseek (pFile , 0 , SEEK_END); lSize = ftell (pFile); rewind (pFile); adverrorinfo = 941; // allocate memory to contain the whole file. buffer = (char*) malloc (lSize); if (buffer == NULL) exit (2); // copy the file into the buffer. fread (buffer,1,lSize,pFile); fclose(pFile); Seperator3 sep3(buffer); for(int i=0; i < 2048; ++i) { // printf("Temp: %s\n", sep3.arghz[i]); char * command; char * temp; temp = sep3.arghz[i]; if (temp == NULL) return; Seperator sep(temp); Seperator4 sep4(temp); command = sep4.arghza[0]; command = strupr(command); #ifdef DEBUG cout<<sep.argplus[0]<<endl; #endif if (!IsCommented(temp)) { if (strstr(command,"END_FILE") != NULL || command == NULL) { break; } if (ti2 || tt2 || tf || td || ta) { char lvl[5]; sprintf(lvl, "%i", this->GetLevel()); strcpy(sep4.arghza[1], strreplace(sep4.arghza[1],"%CHARRACE%", GetRaceName(this->GetRace()))); strcpy(sep4.arghza[1], strreplace(sep4.arghza[1],"%CHARLEVEL%", lvl)); strcpy(sep4.arghza[1], strreplace(sep4.arghza[1],"%CHARCLASS%", GetEQClassName(this->GetClass(), 50))); char * nmessage = strreplace(sep4.arghza[1],"%CHARNAME%", this->GetName()); nmessage[strlen(nmessage) - 1] = '\0'; if (ti2 || tt2 || ta) { other->CastToNPC()->FaceTarget(this, true); } if ((fac == 7 || fac == 6) && (ti2 || tt2)) { entity_list.NPCMessage(other,true,200,0,"%s says, 'I will have nothing to do with such as you. Begone.'",other->GetName()); break; } else if (strstr(command,"FACTION_CHECK") != NULL) { int8 fac2 = atoi(sep.arg[1]); if ((fac2 <= 5 && fac > fac2) || (fac2 == 6 && fac == 8)) { entity_list.NPCMessage(other,true,200,0,"%s says, 'I will have nothing to do with such as you. Begone.'",other->GetName()); break; } ps = true; } else if (strstr(command,"SAY") != NULL) { entity_list.NPCMessage(this, false, 400, 0, "%s says, '%s'", other->GetName(), nmessage); ps = true; } else if (strstr(command,"EMOTE") != NULL) { cout<<"Emoting!"<<endl; entity_list.NPCMessage(this, false, 400, 0, "%s %s", other->GetName(), nmessage); ps = true; } else if (strstr(command,"TEXT") != NULL) { entity_list.NPCMessage(this, false, 400, 0, "%s", nmessage); ps = true; } else if (strstr(command,"SHOUT") != NULL) { entity_list.NPCMessage(this, false, 0, 13, "%s shouts, '%s'", other->GetName(), nmessage); ps = true; } else if (strstr(command,"SPAWN_ITEM") != NULL) { this->SummonItem(atoi(sep.arg[1])); ps = true; } else if (strstr(command,"ADD_HATELIST") != NULL) { other->CastToNPC()->AddToHateList(this, 100); ps = true; } else if (strstr(command,"DEPOP") != NULL) { other->CastToNPC()->Depop(); ps = true; } #ifdef GUILDWARS else if (strstr(command,"CITYTAKE") != NULL) { if(IsClient() && GuildDBID() != 0) { if(target->CastToNPC()->GetGuildOwner() == GuildDBID()) { entity_list.NPCMessage(this, false, 400, 0, "%s says, 'You are a member of the guild that owns this city, why would you want to conquere it?'", other->GetName(), nmessage); } else if(!IsAttackAllowed(other)) { entity_list.NPCMessage(this, false, 400, 0, "%s says, 'You cannot conquere an allied city.'", other->GetName(), nmessage); } else if(database.CityDefense(zone->GetZoneID(),0)) { entity_list.NPCMessage(this, false, 400, 0, "%s says, 'This city still has men standing, I will not surrender!'", other->GetName(), nmessage); } else if(database.SetCityGuildOwned(GuildDBID(),other->GetNPCTypeID())) { entity_list.NPCMessage(this, false, 400, 0, "%s says, 'You have won, I surrender to you.'", other->GetName(), nmessage); zone->SetGuildOwned(GuildDBID()); zone->Repop(); } } ps = true; } #endif else if (strstr(command,"SPAWN_NPC") != NULL) { adverrorinfo = 751; const NPCType* tmp = 0; adverrorinfo = 752; int16 grid = atoi(sep.arg[2]); int8 guildwarset = atoi(sep.arg[3]); if ((tmp = database.GetNPCType(atoi(sep.arg[1])))) { adverrorinfo = 753; NPC* npc = new NPC(tmp, 0, other->GetX(), other->GetY(), other->GetZ(), heading); adverrorinfo = 754; npc->AddLootTable(); adverrorinfo = 755; entity_list.AddNPC(npc,true,true); adverrorinfo = 756; Sleep(200); if(npc != 0) { if(grid > 0) npc->AssignWaypoints(grid); adverrorinfo = 757; #ifdef GUILDWARS if(guildwarset > 0 && guildwarset == 1 && GuildDBID() > 0) npc->SetGuildOwner(GuildDBID()); #endif adverrorinfo = 758; npc->SendPosUpdate(); } } ps = true; } else if (strstr(command,"LEVEL_CHECK") != NULL) { int8 Level1 = atoi(sep.arg[1]); int8 Level2 = atoi(sep.arg[2]); int8 Levelp = this->GetLevel(); if(Level2 == 0 || Level2 == NULL){ //Min Level if(Level1 > Levelp) { //not high enough to talk too break; } } else{ //Level Range if(Level1 < Levelp && Level2 < Levelp) { //not in the req level range break; } } levelcheck = true; } else if (strstr(command,"CUMULATIVE_FLAG") != NULL) { other->flag[50] = other->flag[50] + 1; ps = true; } else if (strstr(command,"NPC_FLAG") != NULL) { other->flag[atoi(sep.arg[1])] = atoi(sep.arg[2]); ps = true; } else if (strstr(command,"PLAYER_FLAG") != NULL) { this->flag[atoi(sep.arg[1])] = atoi(sep.arg[2]); ps = true; } else if (strstr(command,"EXP") != NULL) { this->AddEXP (atoi(sep.arg[1])); ps = true; } else if (strstr(command,"LEVEL") != NULL) { this->SetLevel(atoi(sep.arg[1]), true); ps = true; } else if (strstr(command,"SAFEMOVE") != NULL) { this->MovePC(zone->GetShortName(),database.GetSafePoint(zone->GetShortName(),"x"),database.GetSafePoint(zone->GetShortName(),"y"),database.GetSafePoint(zone->GetShortName(),"z"),false,false); ps = true; } else if (strstr(command,"RAIN") != NULL) { zone->zone_weather = atoi(sep.arg[1]); APPLAYER* outapp = new APPLAYER; outapp = new APPLAYER; outapp->opcode = OP_Weather; outapp->pBuffer = new uchar[8]; memset(outapp->pBuffer, 0, 8); outapp->size = 8; outapp->pBuffer[4] = atoi(sep.arg[1]); // Why not just use 0x01/2/3? entity_list.QueueClients(this, outapp); delete outapp; ps = true; } else if (strstr(command,"SNOW") != NULL) { zone->zone_weather = atoi(sep.arg[1]) + 1; APPLAYER* outapp = new APPLAYER; outapp = new APPLAYER; outapp->opcode = OP_Weather; outapp->pBuffer = new uchar[8]; memset(outapp->pBuffer, 0, 8); outapp->size = 8; outapp->pBuffer[0] = 0x01; outapp->pBuffer[4] = atoi(sep.arg[1]); entity_list.QueueClients(this, outapp); delete outapp; ps = true; } else if (strstr(command,"GIVE_CASH") != NULL) { this->AddMoneyToPP(atoi(sep.arg[1]),true); ps = true; } else if (strstr(command,"GIVE_ITEM") != NULL) { int16 ItemID = atoi(sep.arg[1]); sint8 ItemCharges = atoi(sep.arg[2]); this->SummonItem(ItemID, ItemCharges); ps = true; } else if (strstr(command,"CAST_SPELL") != NULL) { other->CastSpell(atoi(sep.arg[1]),this->GetID()); ps = true; } else if (strstr(command,"PVP") != NULL) { if (strstr(strupr(sep.arg[1]),"ON") != NULL) this->CastToClient()->SetPVP(true); else this->CastToClient()->SetPVP(false); ps = true; } /*else if (strstr(command,"CHANGEFACTION") != NULL) { if ((sep.IsNumber(1)) && (sep.IsNumber(2))) { this->CastToClient()->SetFactionLevel2(this->CastToClient()->CharacterID(),atoi(sep.arg[1]), this->CastToClient()->GetClass(), this->CastToClient()->GetRace(), this->CastToClient()->GetDeity(), atoi(sep.arg[2])); this->CastToClient()->Message(0,BuildFactionMessage(GetCharacterFactionLevel(atoi(sep.arg[1])),atoi(sep.arg[1]))); } else { cout << "Error in script!!!!! Bad CHANGEFACTION Line! " << endl; } ps = true; }*/ else if (strstr(command,"DO_ANIMATION") != NULL) { other->DoAnim(atoi(sep.arg[1])); ps = true; } else if (strstr(command,"ADDSKILL") != NULL) { if (sep.IsNumber(1) && sep.IsNumber(2) && (atoi(sep.arg[2]) >= 0 || atoi(sep.arg[2]) <= 252) && (atoi(sep.arg[1]) >= 0 && atoi(sep.arg[1]) < 74)) { this->AddSkill(atoi(sep.arg[1]), atoi(sep.arg[2])); } else cout << "Error in script!!!! Bad ADDSKILL line!" << endl; ps = true; } else if (strstr(command,"FLAG_CHECK") != NULL) { if (this->flag[atoi(sep.arg[1])] == 0) break; else this->flag[atoi(sep.arg[1])] = 0; ps = true; } else if (strstr(command,"CHANCE") != NULL) { if (rand()%100 > atoi(sep.arg[1])) break; ps = true; } } if (IsEnd(temp)) { tt = false; tt2 = false; stt = false; ti = false; ti2 = false; sti = false; tk = false; td = false; std = false; ta = false; sta = false; tf = false; stf = false; stk = false; } if (strstr(command,"TRIGGER_ATTACK") != NULL) { if (strstr(message,"%%ATTACK%%") != NULL) { adverrorinfo = 943; ta = true; } else { sta = true; } } else if (strstr(command,"TRIGGER_DEATH") != NULL) { if (strstr(message,"%%DEATH%%") != NULL) { td = true; } else { std = true; } } else if (strstr(command,"TRIGGER_KILLED") != NULL) { if (strstr(message,"%%KILLED%%") != NULL) { tk = true; } else { stk = true; } } else if (strstr(command,"TRIGGER_FLAGS") != NULL) { int8 flag1 = atoi(sep.arg[1]); int8 flag2 = atoi(sep.arg[2]); int8 flag3 = atoi(sep.arg[3]); int8 flag4 = atoi(sep.arg[4]); if (flag1 == 50) { if (other->flag[50] >= atoi(sep.arg[2])) { tf = true; other->flag[50] = 0; } else stf = true; } else { if (ta || tt || ti) stf = true; else if (flag1 > 0 && other->flag[flag1] == 0) stf = true; else if (flag2 > 0 && other->flag[flag2] == 0) stf = true; else if (flag3 > 0 && other->flag[flag3] == 0) stf = true; else if (flag4 > 0 && other->flag[flag4] == 0) stf = true; else { tf = true; if (flag1 > 0) other->flag[flag1] = 0; if (flag2 > 0) other->flag[flag2] = 0; if (flag3 > 0) other->flag[flag3] = 0; if (flag4 > 0) other->flag[flag4] = 0; } } } else if (strstr(command,"TRIGGER_ITEM") != NULL) { if (!ta && !tt && !ti) { if ((uint16)item_id == atoi(sep4.arghza[1])) { ti = true; ti2 = true; } else { sti = true; } } else { printf("TRIGGER_ITEM Error at line %d: missing left curly bracket\n", i); return; } } else if (strstr(command,"TRIGGER_TEXT") != NULL) { if (strstr(message,"%%DEATH%%") == NULL && strstr(message,"%%ITEM%%") == NULL && strstr(message,"%%ATTACK%%") == NULL && strstr(message,"%%KILLED%%") == NULL && Dist(other) <= 50) { char* tmp = new char[strlen(message)+1]; strcpy(tmp, message); strupr(tmp); if (strstr(tmp,strupr(sep4.arghza[1])) != NULL) { tt2 = true; tt = true; } else { stt = true; } delete tmp; } else if (strstr(message,"%%DEATH%%") != NULL || strstr(message,"%%item%%") != NULL || strstr(message,"%%attack%%")) { stt = true; } else if (!ps) { printf("TRIGGER_TEXT Error at line %d: Not in NPC_Script\n", i); return; } else { printf("TRIGGER_TEXT Error at line %d: missing left curly bracket\n", i); return; } } /*#ifdef WIN32 delete command; delete temp; #endif*/ } } if (!ps && item_id != 0) { entity_list.NPCMessage(this,true,200,0,"%s has no use for this item.",other->GetName()); SummonItem(item_id); } delete buffer; }