Merge pull request #4 from EQEmu/master

sync
This commit is contained in:
josheb 2013-05-09 06:19:29 -07:00
commit 56b15f558c
8 changed files with 35 additions and 32 deletions

View File

@ -428,7 +428,7 @@ bool Database::ReserveName(uint32 account_id, char* name)
char errbuf[MYSQL_ERRMSG_SIZE];
char *query = 0;
if (!RunQuery(query, MakeAnyLenString(&query, "INSERT into character_ SET account_id=%i, name='%s', profile=nullptr", account_id, name), errbuf)) {
if (!RunQuery(query, MakeAnyLenString(&query, "INSERT into character_ SET account_id=%i, name='%s', profile=NULL", account_id, name), errbuf)) {
cerr << "Error in ReserveName query '" << query << "' " << errbuf << endl;
safe_delete_array(query);
return false;
@ -1196,9 +1196,9 @@ bool Database::GetSafePoints(const char* short_name, uint32 version, float* safe
{
cerr << "Error in GetSafePoint query '" << query << "' " << errbuf << endl;
cerr << "If it errors, run the following querys:\n";
cerr << "ALTER TABLE `zone` CHANGE `minium_level` `min_level` TINYINT(3) UNSIGNED DEFAULT \"0\" NOT nullptr;\n";
cerr << "ALTER TABLE `zone` CHANGE `minium_status` `min_status` TINYINT(3) UNSIGNED DEFAULT \"0\" NOT nullptr;\n";
cerr << "ALTER TABLE `zone` ADD flag_needed VARCHAR(128) NOT nullptr DEFAULT '';\n";
cerr << "ALTER TABLE `zone` CHANGE `minium_level` `min_level` TINYINT(3) UNSIGNED DEFAULT \"0\" NOT NULL;\n";
cerr << "ALTER TABLE `zone` CHANGE `minium_status` `min_status` TINYINT(3) UNSIGNED DEFAULT \"0\" NOT NULL;\n";
cerr << "ALTER TABLE `zone` ADD flag_needed VARCHAR(128) NOT NULL DEFAULT '';\n";
safe_delete_array(query);
}

View File

@ -6129,7 +6129,7 @@ void Client::Handle_OP_RecipesFavorite(const EQApplicationPacket *app)
" LEFT JOIN tradeskill_recipe_entries AS tre ON tr.id=tre.recipe_id "
" LEFT JOIN (SELECT recipe_id, madecount FROM char_recipe_list WHERE char_id = %u) AS crl ON tr.id=crl.recipe_id "
" WHERE tr.id IN (%s) "
" AND tr.must_learn & 0x20 <> 0x20 AND ((tr.must_learn & 0x3 <> 0 AND crl.madecount IS NOT nullptr) OR (tr.must_learn & 0x3 = 0)) "
" AND tr.must_learn & 0x20 <> 0x20 AND ((tr.must_learn & 0x3 <> 0 AND crl.madecount IS NOT NULL) OR (tr.must_learn & 0x3 = 0)) "
" GROUP BY tr.id "
" HAVING sum(if(tre.item_id %s AND tre.iscontainer > 0,1,0)) > 0 "
" LIMIT 100 ", CharacterID(), buf, containers);
@ -6184,7 +6184,7 @@ void Client::Handle_OP_RecipesSearch(const EQApplicationPacket *app)
" LEFT JOIN tradeskill_recipe_entries AS tre ON tr.id=tre.recipe_id "
" LEFT JOIN (SELECT recipe_id, madecount FROM char_recipe_list WHERE char_id = %u) AS crl ON tr.id=crl.recipe_id "
" WHERE %s tr.trivial >= %u AND tr.trivial <= %u "
" AND tr.must_learn & 0x20 <> 0x20 AND((tr.must_learn & 0x3 <> 0 AND crl.madecount IS NOT nullptr) OR (tr.must_learn & 0x3 = 0)) "
" AND tr.must_learn & 0x20 <> 0x20 AND((tr.must_learn & 0x3 <> 0 AND crl.madecount IS NOT NULL) OR (tr.must_learn & 0x3 = 0)) "
" GROUP BY tr.id "
" HAVING sum(if(tre.item_id %s AND tre.iscontainer > 0,1,0)) > 0 "
" LIMIT 200 "

View File

@ -3784,12 +3784,12 @@ void Mob::InsertQuestGlobal(int charid, int npcid, int zoneid, const char *varna
char *query = 0;
char errbuf[MYSQL_ERRMSG_SIZE];
// Make duration string either "unix_timestamp(now()) + xxx" or "nullptr"
// Make duration string either "unix_timestamp(now()) + xxx" or "NULL"
stringstream duration_ss;
if (duration == INT_MAX)
{
duration_ss << "nullptr";
duration_ss << "NULL";
}
else
{

View File

@ -2432,23 +2432,23 @@ int NPC::GetScore()
if(lv < 46)
{
minx = ceil( ((lv - (lv / 10)) - 1) );
minx = static_cast<int> (ceil( ((lv - (lv / 10.0)) - 1.0) ));
basehp = (lv * 10) + (lv * lv);
}
else
{
minx = ceil( ((lv - (lv / 10)) - 1) - (( abs(45 - lv) ) / 2) );
minx = static_cast<int> (ceil( ((lv - (lv / 10.0)) - 1.0) - (( lv - 45.0 ) / 2.0) ));
basehp = (lv * 10) + ((lv * lv) * 4);
}
if(hp > basehp)
{
hpcontrib = (int)( (float)((float)hp / (float)basehp) * 1.5);
hpcontrib = static_cast<int> (((hp / static_cast<float> (basehp)) * 1.5));
if(hpcontrib > 5) { hpcontrib = 5; }
if(maxdmg > basedmg)
{
dmgcontrib = ceil( ((maxdmg / basedmg) * 1.5) );
dmgcontrib = static_cast<int> (ceil( ((maxdmg / basedmg) * 1.5) ));
}
if(HasNPCSpecialAtk("E")) { spccontrib++; } //Enrage
@ -2463,9 +2463,11 @@ int NPC::GetScore()
}
if(npc_spells_id > 12)
{
if(lv < 16) { spccontrib++; }
else { spccontrib += (int)floor(lv/15); }
{
if(lv < 16)
spccontrib++;
else
spccontrib += static_cast<int> (floor(lv/15.0));
}
final = minx + hpcontrib + dmgcontrib + spccontrib;

View File

@ -2236,7 +2236,7 @@ XS(boot_NPC)
newXSproto(strcpy(buf, "GetAttackSpeed"), XS_NPC_GetSlowMitigation, file, "$");
newXSproto(strcpy(buf, "GetAccuracyRating"), XS_NPC_GetAccuracyRating, file, "$");
newXSproto(strcpy(buf, "GetSpawnKillCount"), XS_NPC_GetSpawnKillCount, file, "$");
newXSproto(strcpy(buf, "GetScore"), XS_NPC_GetSpawnKillCount, file, "$");
newXSproto(strcpy(buf, "GetScore"), XS_NPC_GetScore, file, "$");
XSRETURN_YES;
}

View File

@ -1241,11 +1241,11 @@ int QuestManager::InsertQuestGlobal(
char *query = 0;
char errbuf[MYSQL_ERRMSG_SIZE];
// Make duration string either "unix_timestamp(now()) + xxx" or "nullptr"
// Make duration string either "unix_timestamp(now()) + xxx" or "NULL"
stringstream duration_ss;
if (duration == INT_MAX)
{
duration_ss << "nullptr";
duration_ss << "NULL";
}
else
{

View File

@ -1158,7 +1158,7 @@ void TaskManager::SendTaskSelector(Client *c, Mob *mob, int TaskCount, int *Task
if(Tasks[TaskList[i]] != nullptr) break;
}
// FIXME: The 10 and 5 values in this calculation are to account for the string "nullptr" we are putting in 3 times.
// FIXME: The 10 and 5 values in this calculation are to account for the string "ABCD" we are putting in 3 times.
//
// Calculate how big the packet needs to be pased on the number of tasks and the
// size of the variable length strings.
@ -1236,9 +1236,9 @@ void TaskManager::SendTaskSelector(Client *c, Mob *mob, int TaskCount, int *Task
// FIXME: In live packets, these two strings appear to be the same as the Text1 and Text2
// strings from the first activity in the task, however the task chooser/selector
// does not appear to make use of them.
sprintf(Ptr, "nullptr");
sprintf(Ptr, "ABCD");
Ptr = Ptr + strlen(Ptr) + 1;
sprintf(Ptr, "nullptr");
sprintf(Ptr, "ABCD");
Ptr = Ptr + strlen(Ptr) + 1;
AvailableTaskTrailer = (AvailableTaskTrailer_Struct*)Ptr;
@ -1253,7 +1253,7 @@ void TaskManager::SendTaskSelector(Client *c, Mob *mob, int TaskCount, int *Task
// In some packets, this next string looks like a short task summary, however it doesn't
// appear anywhere in the client window.
sprintf(Ptr, "nullptr");
sprintf(Ptr, "ABCD");
Ptr = Ptr + strlen(Ptr) + 1;
}

View File

@ -2676,22 +2676,22 @@ void Zone::LoadTickItems()
char* query = 0;
MYSQL_RES *result;
MYSQL_ROW row;
tick_items.clear();
//tick_globals.clear();
if(database.RunQuery(query, MakeAnyLenString(&query, "SELECT it_itemid, it_chance, it_level, it_qglobal, it_bagslot FROM item_tick"), errbuf, &result))
{
while((row = mysql_fetch_row(result)))
{
if(atoi(row[0]) < 1)
{
//tick_globals[std::string(row[0])] = { 0, atoi(row[1]), atoi(row[2]), (int16)atoi(row[4]), std::string(row[3]) };
}
else
{
tick_items[atoi(row[0])] = { atoi(row[0]), atoi(row[1]), atoi(row[2]), (int16)atoi(row[4]), std::string(row[3]) };
}
if(atoi(row[0]) >= 1)
{
item_tick_struct ti_tmp;
ti_tmp.itemid = atoi(row[0]);
ti_tmp.chance = atoi(row[1]);
ti_tmp.level = atoi(row[2]);
ti_tmp.bagslot = (int16)atoi(row[4]);
ti_tmp.qglobal = std::string(row[3]);
tick_items[atoi(row[0])] = ti_tmp;
}
}
mysql_free_result(result);
safe_delete_array(query);
@ -2715,6 +2715,7 @@ uint32 Zone::GetSpawnKillCount(uint32 in_spawnid) {
}
iterator.Advance();
}
return 0;
}
void Zone::UpdateHotzone()