void CInstance::lockBcnm(){ for(int i=0; i<m_PlayerList.size(); i++){ if(!m_PlayerList.at(i)->m_insideBCNM){ ShowDebug("Removing %s from the valid players list for BCNMID %i Instance %i \n",m_PlayerList.at(i)->GetName(), this->m_BcnmID,this->m_InstanceNumber); if(this->delPlayerFromBcnm(m_PlayerList.at(i))){i--;} } } }
// q?f[^? int inter_storage_delete(int account_id) { sprintf(tmp_sql, "DELETE FROM `%s` WHERE `account_id`='%d'",storage_db, account_id); if(mysql_query(&mysql_handle, tmp_sql) ) { ShowSQL("DB error - %s\n",mysql_error(&mysql_handle)); ShowDebug("at %s:%d - %s\n", __FILE__,__LINE__,tmp_sql); } return 0; }
CGuild* GetGuild(uint8 GuildID) { if (GuildID < g_PGuildList.size()) { return g_PGuildList.at(GuildID); } ShowDebug(CL_CYAN"Guild with id <%u> is not found on server\n" CL_RESET, GuildID); return nullptr; }
// Received wisp message from map-server for ALL gm (just copy the message and resends it to ALL map-servers) int mapif_parse_WisToGM(int fd) { unsigned char buf[2048]; // 0x3003/0x3803 <packet_len>.w <wispname>.24B <min_gm_level>.w <message>.?B ShowDebug("Sent packet back!\n"); memcpy(WBUFP(buf,0), RFIFOP(fd,0), RFIFOW(fd,2)); WBUFW(buf, 0) = 0x3803; mapif_sendall(buf, RFIFOW(fd,2)); return 0; }
void TViewCodeGenerator::GenerateAll(const char *APath,const char *ClassName) { TCodeGenerator::GenerateAll(APath,ClassName); ShowDebug(string("GenerateAll ClassName=") + ClassName); PrepareCode(APath,ClassName,true); /* // ------- COMPONENT LIST! -------------- TComponent *AComponent = FViewComponent->FChildren->NextComponent(true); ShowDebug("TViewCodeGenerator::GenerateAll After NextComponent"); while(AComponent!=NULL) { ShowDebug("TViewCodeGenerator::GenerateAll Before Generate"); AComponent->Generate(APath); ShowDebug("TViewCodeGenerator::GenerateAll After Generate"); AComponent = FViewComponent->FChildren->NextComponent(false); } */ ShowDebug("TViewCodeGenerator::GenerateAll Exit from While"); }
//Add player to dynamis bool CBattlefield::addPlayerToDynamis(CCharEntity* PChar) { //split to get the reason for debugging if(m_PlayerList.size() >= m_MaxParticipants) { ShowDebug("Cannot add %s to Dynamis list, max size reached.\n",PChar->GetName()); return false; } if(PChar->StatusEffectContainer->HasStatusEffect(EFFECT_DYNAMIS, 0) || PChar->StatusEffectContainer->HasStatusEffect(EFFECT_BATTLEFIELD)) { ShowDebug("Cannot add %s to Dynamis list, they have BC effect.\n",PChar->GetName()); return false; } if(PChar->getZone() != m_ZoneID) { ShowDebug("Cannot add %s to Dynamis list, not in right zone.\n",PChar->GetName()); return false; } m_PlayerList.push_back(PChar); PChar->StatusEffectContainer->AddStatusEffect(new CStatusEffect(EFFECT_DYNAMIS,0,this->m_BcnmID,0,0),true); return true; }
/* * verify that the choosen langtype is enable * return * 1 : langage enable * -1 : false range * -2 : disable */ int msg_checklangtype(int lang, bool display){ uint16 test= (1<<(lang-1)); if(!lang) return 1; //default english else if(lang < 0 || test > LANG_MAX) return -1; //false range else if (LANG_ENABLE&test) return 1; else if(display) { ShowDebug("Unsupported langtype '%d'.\n",lang); } return -2; }
bool spawnSecondPartDynamis(CInstance* instance){ DSP_DEBUG_BREAK_IF(instance==NULL); //get ids from DB const int8* fmtQuery = "SELECT monsterId \ FROM bcnm_instance \ WHERE bcnmId = %u AND instanceNumber = 2"; int32 ret = Sql_Query(SqlHandle, fmtQuery, instance->getID()); if (ret == SQL_ERROR || Sql_NumRows(SqlHandle) == 0) { ShowError("spawnSecondPartDynamis : SQL error - Cannot find any monster IDs for Dynamis %i \n", instance->getID(), instance->getInstanceNumber()); } else{ while(Sql_NextRow(SqlHandle) == SQL_SUCCESS){ uint32 mobid = Sql_GetUIntData(SqlHandle,0); CMobEntity* PMob = (CMobEntity*)zoneutils::GetEntity(mobid, TYPE_MOB); if (PMob != NULL) { if (PMob->PBattleAI->GetCurrentAction() == ACTION_NONE || PMob->PBattleAI->GetCurrentAction() == ACTION_SPAWN) { PMob->PBattleAI->SetLastActionTime(0); PMob->PBattleAI->SetCurrentAction(ACTION_SPAWN); PMob->m_instanceID = instance->getInstanceNumber(); ShowDebug("Spawned %s (%u) id %i inst %i \n",PMob->GetName(),PMob->id,instance->getID(),instance->getInstanceNumber()); instance->addEnemy(PMob, CONDITION_SPAWNED_AT_START & CONDITION_WIN_REQUIREMENT); } else { ShowDebug(CL_CYAN"spawnSecondPartDynamis: <%s> (%u) is alredy spawned\n" CL_RESET, PMob->GetName(), PMob->id); } } else { ShowDebug("spawnSecondPartDynamis: mob %u not found\n", mobid); } } return true; } return false; }
//--------------------------------------------------------- // storage data initialize int inter_storage_sql_init(void) { //memory alloc ShowDebug("interserver storage memory initialize....(%d byte)\n",sizeof(struct storage)); storage_pt = (struct storage*)aCalloc(sizeof(struct storage), 1); guild_storage_pt = (struct guild_storage*)aCalloc(sizeof(struct guild_storage), 1); return 1; }
void afk_timeout_adjust(const char *val) { //In Seconds int value = config_switch(val); if (value < 0){ ShowDebug("Received Invalid Setting for afk_timeout(%d), defaulting to 0\n",value); return; } afk_timeout = value; return; }
void main(int argc,char **argv) { if (DOpusBase=OpenLibrary("dopus5.library",0)) { if (argv[1] && *argv[1]) ShowDebug(argv[1]); CloseLibrary(DOpusBase); } exit(0); }
const char *mapindex_id2name (unsigned short id) { if (id > MAX_MAPINDEX || !mapindex_exists (id)) { ShowDebug ("mapindex_id2name: Requested name for non-existant map index [%d] in cache.\n", id); return indexes[0].name; // dummy empty string so that the callee doesn't crash } return indexes[id].name; }
bool spawnSecondPartDynamis(CBattlefield* battlefield) { DSP_DEBUG_BREAK_IF(battlefield == nullptr); //get ids from DB const int8* fmtQuery = "SELECT monsterId \ FROM bcnm_battlefield \ WHERE bcnmId = %u AND battlefieldNumber = 2"; int32 ret = Sql_Query(SqlHandle, fmtQuery, battlefield->getID()); if (ret == SQL_ERROR || Sql_NumRows(SqlHandle) == 0) { ShowError("spawnSecondPartDynamis : SQL error - Cannot find any monster IDs for Dynamis %i \n", battlefield->getID(), battlefield->getBattlefieldNumber()); } else { while (Sql_NextRow(SqlHandle) == SQL_SUCCESS) { uint32 mobid = Sql_GetUIntData(SqlHandle, 0); CMobEntity* PMob = (CMobEntity*)zoneutils::GetEntity(mobid, TYPE_MOB); if (PMob != nullptr) { if (!PMob->PAI->IsSpawned()) { PMob->Spawn(); PMob->m_battlefieldID = battlefield->getBattlefieldNumber(); ShowDebug("Spawned %s (%u) id %i inst %i \n", PMob->GetName(), PMob->id, battlefield->getID(), battlefield->getBattlefieldNumber()); battlefield->addEnemy(PMob, CONDITION_SPAWNED_AT_START & CONDITION_WIN_REQUIREMENT); } else { ShowDebug(CL_CYAN"spawnSecondPartDynamis: <%s> (%u) is already spawned\n" CL_RESET, PMob->GetName(), PMob->id); } } else { ShowDebug("spawnSecondPartDynamis: mob %u not found\n", mobid); } } return true; } return false; }
int inter_delete_homunculus(int hom_id) { sprintf(tmp_sql, "DELETE FROM `homunculus` WHERE `homun_id` = '%u'", hom_id); if(mysql_query(&mysql_handle, tmp_sql)) { ShowSQL("DB error - %s\n",mysql_error(&mysql_handle)); ShowDebug("at %s:%d - %s\n", __FILE__,__LINE__,tmp_sql); return 0; } sprintf(tmp_sql, "DELETE FROM `skill_homunculus` WHERE `homun_id` = '%u'", hom_id); if(mysql_query(&mysql_handle, tmp_sql)) { ShowSQL("DB error - %s\n",mysql_error(&mysql_handle)); ShowDebug("at %s:%d - %s\n", __FILE__,__LINE__,tmp_sql); return 0; } return 1; }
int log_pick_pc(struct map_session_data *sd, const char *type, int nameid, int amount, struct item *itm) { FILE *logfp; char *mapname; nullpo_retr(0, sd); //Should we log this item? [Lupus] if (!should_log_item(log_config.filter,nameid, amount)) return 0; //we skip logging this items set - they doesn't met our logging conditions [Lupus] mapname = (char*)mapindex_id2name(sd->mapindex); if(mapname==NULL) mapname=""; #ifndef TXT_ONLY if(log_config.sql_logs > 0) { if (itm==NULL) { //We log common item sprintf(tmp_sql, "INSERT DELAYED INTO `%s` (`time`, `char_id`, `type`, `nameid`, `amount`, `map`) VALUES (NOW(), '%d', '%s', '%d', '%d', '%s')", log_config.log_pick_db, sd->status.char_id, type, nameid, amount, mapname); } else { //We log Extended item sprintf(tmp_sql, "INSERT DELAYED INTO `%s` (`time`, `char_id`, `type`, `nameid`, `amount`, `refine`, `card0`, `card1`, `card2`, `card3`, `map`) VALUES (NOW(), '%d', '%s', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%s')", log_config.log_pick_db, sd->status.char_id, type, itm->nameid, amount, itm->refine, itm->card[0], itm->card[1], itm->card[2], itm->card[3], mapname); } if(mysql_query(&logmysql_handle, tmp_sql)) { ShowSQL("DB error - %s\n",mysql_error(&logmysql_handle)); ShowDebug("at %s:%d - %s\n", __FILE__,__LINE__,tmp_sql); return 0; } return 1; } #endif if((logfp=fopen(log_config.log_pick,"a+")) == NULL) return 0; time(&curtime); strftime(timestring, 254, "%m/%d/%Y %H:%M:%S", localtime(&curtime)); if (itm==NULL) { //We log common item fprintf(logfp,"%s - %d\t%s\t%d,%d,%s%s", timestring, sd->status.char_id, type, nameid, amount, mapname, RETCODE); } else { //We log Extended item fprintf(logfp,"%s - %d\t%s\t%d,%d,%d,%d,%d,%d,%d,%s%s", timestring, sd->status.char_id, type, itm->nameid, amount, itm->refine, itm->card[0], itm->card[1], itm->card[2], itm->card[3], mapname, RETCODE); } fclose(logfp); return 1; //Logged }
unsigned short mapindex_name2id(const char* name) { int i; char map_name[MAP_NAME_LENGTH]; mapindex_getmapname(name, map_name); if( (i = strdb_iget(mapindex_db, map_name)) ) return i; ShowDebug("mapindex_name2id: Map \"%s\" not found in index list!\n", map_name); return 0; }
uint16 GetWord(uint32 val, int idx) { switch( idx ) { case 0: return (uint16)( (val & 0x0000FFFF) ); case 1: return (uint16)( (val & 0xFFFF0000) >> 0x10 ); default: #if defined(DEBUG) #endif ShowDebug("GetWord: invalid index (idx=%d)\n", idx); return 0; } }
//--------------------------------------------------------- // storage data initialize int inter_storage_sql_init(void) { //memory alloc ShowDebug("interserver storage memory initialize....(%d byte)\n",sizeof(struct storage)); storage_pt = (struct storage*)aCalloc(sizeof(struct storage), 1); guild_storage_pt = (struct guild_storage*)aCalloc(sizeof(struct guild_storage), 1); // memset(storage_pt,0,sizeof(struct storage)); //Calloc sets stuff to 0 already. [Skotlex] // memset(guild_storage_pt,0,sizeof(struct guild_storage)); return 1; }
void CBattlefield::lockBcnm() { for(int i=0; i<m_PlayerList.size(); i++) { if (!m_PlayerList.at(i)->PBCNM) { ShowDebug("Removing %s from the valid players list for BCNMID %i Battlefield %i \n",m_PlayerList.at(i)->GetName(), this->m_BcnmID,this->m_BattlefieldNumber); if(this->delPlayerFromBcnm(m_PlayerList.at(i))) { i--; } } } }
static char log_cashtype2char( e_log_cash_type type ){ switch( type ){ case LOG_CASH_TYPE_CASH: return 'C'; case LOG_CASH_TYPE_KAFRA: return 'K'; } ShowDebug("log_chattype2char: Unknown chat type %d.\n", type); return 'O'; }
static char log_feedingtype2char(e_log_feeding_type type) { switch(type) { case LOG_FEED_HOMUNCULUS: return 'H'; case LOG_FEED_PET: return 'P'; } ShowDebug("log_feedingtype2char: Unknown feeding type %d.\n", type); return 'O'; }
CItemContainer* GetGuildShop(uint16 GuildID) { for (uint16 i = 0; i < g_PGuildList.size(); ++i) { if (g_PGuildList.at(i)->GetID() == GuildID) { return g_PGuildList.at(i); } } ShowDebug(CL_CYAN"Guild with id <%u> is not found on server\n" CL_RESET); return NULL; }
CItemContainer* GetGuildShop(uint16 GuildShopID) { for (auto PGuildShop : g_PGuildShopList) { if (PGuildShop->GetID() == GuildShopID) { return PGuildShop; } } ShowDebug(CL_CYAN"GuildShop with id <%u> is not found on server\n" CL_RESET, GuildShopID); return nullptr; }
uint16 GetWord(uint32 val, int idx) { switch(idx) { case 0: return (uint16)((val & 0x0000FFFF)); case 1: return (uint16)((val & 0xFFFF0000) >> 0x10); default: #if defined(DEBUG) ShowDebug(read_message("Source.common.getword"), idx); #endif return 0; } }
TProjectComponent::TProjectComponent(char *AComponentName, char *AClassName):TComponent(AComponentName,AClassName),BHandler(AComponentName) //TProjectComponent::TProjectComponent(char *AComponentName, char *AClassName):TComponent(AComponentName,AClassName),BLooper(AComponentName) { FDebugMode=1; FDebugMessage= "TProjectComponent "; FHandler = this; FElement = NULL; FCanGenerate = true; ShowDebug("Constructeur!"); FCodeGenerator = new TProjectCodeGenerator(this,true); FPropertyList->AddProperty(PROP_NAME,AComponentName,PROP_TYPE_STRING,false,true,"",PROP_GENERAL_GROUP); FPropertyList->AddProperty(PROP_CLASSNAME,AClassName,PROP_TYPE_STRING,false,true,"",PROP_GENERAL_GROUP); FPropertyList->AddProperty(PROP_GENERATION_PATH,BE_BUILDER_GENERATION,PROP_TYPE_STRING,false,true,"",PROP_GENERAL_GROUP); FPropertyList->AddProperty(PROP_APP_SIGNATURE,"application/x-vnd.BeBuilderApp",PROP_TYPE_STRING,false,true,"",PROP_GENERAL_GROUP); FGenerationPath = "/boot/BeBuilder/Generation/"; FPathGeneration = FGenerationPath; FIndex=0; ShowDebug("Constructeur Fin."); }
bool TProjectComponent::ChangeProperty(string APropertyName, string APropertyValue) { ShowDebug("ChangeProperty Inside."); // int ind; ShowDebug("ChangeProperty Before SetStandardProperties."); SetStandardProperties(APropertyName.c_str(),APropertyValue.c_str()); ShowDebug("ChangeProperty After SetStandardProperties."); FPropertyList->SetPropertyValue(APropertyName,APropertyValue); ShowDebug("ChangeProperty After SetPropertyValue."); if (FindPropertyName(APropertyName,PROP_GENERATION_PATH)) { ShowDebug("ChangeProperty After FindPropertyName."); SetGenerationPath(APropertyValue.c_str()); /* ind = APropertyValue.length(); if (ind !=0) { if (APropertyValue[ind-1]!='/') { APropertyValue = APropertyValue + '/' ; } } else APropertyValue = "/"; FGenerationPath = APropertyValue; */ FPathGeneration = FGenerationPath; } ShowDebug("ChangeProperty Before Asking a dynamic regeneration."); return TComponent::ChangeProperty(APropertyName,APropertyValue); // (FPropertyList->GetProperty(APropertyName))->UpdateCode(); // ShowDebug("TProjectComponent::MessageReceived After Asking a dynamic regeneration."); // return true; }
void CTreasurePool::DelMember(CCharEntity* PChar) { DSP_DEBUG_BREAK_IF(PChar == NULL); DSP_DEBUG_BREAK_IF(PChar->PTreasurePool != this); for (uint32 i = 0; i < members.size(); ++i) { if (PChar == members.at(i)) { PChar->PTreasurePool = NULL; members.erase(members.begin()+i); break; } } if (m_TreasurePoolType != TREASUREPOOL_ZONE && members.empty()) { ShowDebug(CL_CYAN"TreasurePool::Delete self <%s>\n"CL_RESET, PChar->GetName()); delete this; return; } ShowDebug(CL_CYAN"TreasurePool::DelMember <%s>\n"CL_RESET, PChar->GetName()); }
void CTreasurePool::AddMember(CCharEntity* PChar) { DSP_DEBUG_BREAK_IF(PChar == NULL); DSP_DEBUG_BREAK_IF(PChar->PTreasurePool != this); members.push_back(PChar); if (m_TreasurePoolType == TREASUREPOOL_SOLO && members.size() > 1) { m_TreasurePoolType = TREASUREPOOL_PARTY; } ShowDebug(CL_CYAN"TreasurePool::AddMember <%s>\n"CL_RESET, PChar->GetName()); }
/// obtain log type character for chat logs char log_chattype2char(e_log_chat_type type) { switch( type ) { case LOG_CHAT_GLOBAL: return 'O'; // Gl(O)bal case LOG_CHAT_WHISPER: return 'W'; // (W)hisper case LOG_CHAT_PARTY: return 'P'; // (P)arty case LOG_CHAT_GUILD: return 'G'; // (G)uild case LOG_CHAT_MAINCHAT: return 'M'; // (M)ain chat } // should not get here, fallback ShowDebug("log_chattype2char: Unknown chat type %d.\n", type); return 'O'; }
uint8 CItemContainer::SetSize(uint8 size) { if (size <= MAX_CONTAINER_SIZE) { if (size >= m_count) { m_size = size; return m_size; } } ShowDebug(CL_CYAN"ItemContainer <%u>: Bad new container size %u\n" CL_RESET, m_id, size); return -1; }