mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-13 06:21:28 +00:00
Merge branch 'master' of https://github.com/EQEmu/Server
This commit is contained in:
commit
bee04c1b53
@ -1,5 +1,8 @@
|
||||
EQEMu Changelog (Started on Sept 24, 2003 15:50)
|
||||
-------------------------------------------------------
|
||||
== 11/24/2014 ==
|
||||
Trevius: Added Rule NPC:EnableMeritBasedFaction (disabled by default) - Allows faction gain to work similar to experience.
|
||||
|
||||
== 11/22/2014 ==
|
||||
Trevius: Grouping with Mercenaries is now considerably less buggy.
|
||||
Trevius: Fixed an issue with Spell Globals related to high Character IDs.
|
||||
|
||||
1652
common/database.cpp
1652
common/database.cpp
File diff suppressed because it is too large
Load Diff
@ -93,13 +93,417 @@ struct ExtendedProfile_Struct;
|
||||
struct GuildMember_Struct;
|
||||
class PTimerList;
|
||||
|
||||
#pragma pack(1)
|
||||
|
||||
/* Conversion Structs */
|
||||
|
||||
namespace Convert {
|
||||
struct BindStruct {
|
||||
/*000*/ uint32 zoneId;
|
||||
/*004*/ float x;
|
||||
/*008*/ float y;
|
||||
/*012*/ float z;
|
||||
/*016*/ float heading;
|
||||
};
|
||||
struct Color_Struct
|
||||
{
|
||||
union
|
||||
{
|
||||
struct
|
||||
{
|
||||
uint8 blue;
|
||||
uint8 green;
|
||||
uint8 red;
|
||||
uint8 use_tint; // if there's a tint this is FF
|
||||
} rgb;
|
||||
uint32 color;
|
||||
};
|
||||
};
|
||||
struct AA_Array
|
||||
{
|
||||
uint32 AA;
|
||||
uint32 value;
|
||||
};
|
||||
struct SpellBuff_Struct
|
||||
{
|
||||
/*000*/ uint8 slotid; //badly named... seems to be 2 for a real buff, 0 otherwise
|
||||
/*001*/ uint8 level;
|
||||
/*002*/ uint8 bard_modifier;
|
||||
/*003*/ uint8 effect; //not real
|
||||
/*004*/ uint32 spellid;
|
||||
/*008*/ uint32 duration;
|
||||
/*012*/ uint32 counters;
|
||||
/*016*/ uint32 player_id; //'global' ID of the caster, for wearoff messages
|
||||
/*020*/
|
||||
};
|
||||
struct Tribute_Struct {
|
||||
uint32 tribute;
|
||||
uint32 tier;
|
||||
};
|
||||
struct Disciplines_Struct {
|
||||
uint32 values[MAX_PP_DISCIPLINES];
|
||||
};
|
||||
struct GroupLeadershipAA_Struct {
|
||||
union {
|
||||
struct {
|
||||
uint32 groupAAMarkNPC;
|
||||
uint32 groupAANPCHealth;
|
||||
uint32 groupAADelegateMainAssist;
|
||||
uint32 groupAADelegateMarkNPC;
|
||||
uint32 groupAA4;
|
||||
uint32 groupAA5;
|
||||
uint32 groupAAInspectBuffs;
|
||||
uint32 groupAA7;
|
||||
uint32 groupAASpellAwareness;
|
||||
uint32 groupAAOffenseEnhancement;
|
||||
uint32 groupAAManaEnhancement;
|
||||
uint32 groupAAHealthEnhancement;
|
||||
uint32 groupAAHealthRegeneration;
|
||||
uint32 groupAAFindPathToPC;
|
||||
uint32 groupAAHealthOfTargetsTarget;
|
||||
uint32 groupAA15;
|
||||
};
|
||||
uint32 ranks[MAX_GROUP_LEADERSHIP_AA_ARRAY];
|
||||
};
|
||||
};
|
||||
|
||||
struct RaidLeadershipAA_Struct {
|
||||
union {
|
||||
struct {
|
||||
uint32 raidAAMarkNPC;
|
||||
uint32 raidAANPCHealth;
|
||||
uint32 raidAADelegateMainAssist;
|
||||
uint32 raidAADelegateMarkNPC;
|
||||
uint32 raidAA4;
|
||||
uint32 raidAA5;
|
||||
uint32 raidAA6;
|
||||
uint32 raidAASpellAwareness;
|
||||
uint32 raidAAOffenseEnhancement;
|
||||
uint32 raidAAManaEnhancement;
|
||||
uint32 raidAAHealthEnhancement;
|
||||
uint32 raidAAHealthRegeneration;
|
||||
uint32 raidAAFindPathToPC;
|
||||
uint32 raidAAHealthOfTargetsTarget;
|
||||
uint32 raidAA14;
|
||||
uint32 raidAA15;
|
||||
};
|
||||
uint32 ranks[MAX_RAID_LEADERSHIP_AA_ARRAY];
|
||||
};
|
||||
};
|
||||
|
||||
struct LeadershipAA_Struct {
|
||||
union {
|
||||
struct {
|
||||
Convert::GroupLeadershipAA_Struct group;
|
||||
Convert::RaidLeadershipAA_Struct raid;
|
||||
};
|
||||
uint32 ranks[MAX_LEADERSHIP_AA_ARRAY];
|
||||
};
|
||||
};
|
||||
typedef struct
|
||||
{
|
||||
/*00*/ char Name[64];
|
||||
/*64*/ uint32 Level;
|
||||
/*68*/ uint32 Race;
|
||||
/*72*/ uint32 Class;
|
||||
/*76*/ uint32 Zone;
|
||||
/*80*/ uint32 Time;
|
||||
/*84*/ uint32 Points;
|
||||
/*88*/
|
||||
} PVPStatsEntry_Struct;
|
||||
struct BandolierItem_Struct {
|
||||
uint32 item_id;
|
||||
uint32 icon;
|
||||
char item_name[64];
|
||||
};
|
||||
struct Bandolier_Struct {
|
||||
char name[32];
|
||||
Convert::BandolierItem_Struct items[EmuConstants::BANDOLIER_SIZE];
|
||||
};
|
||||
struct PotionBelt_Struct {
|
||||
Convert::BandolierItem_Struct items[EmuConstants::POTION_BELT_SIZE];
|
||||
};
|
||||
struct SuspendedMinion_Struct
|
||||
{
|
||||
/*000*/ uint16 SpellID;
|
||||
/*002*/ uint32 HP;
|
||||
/*006*/ uint32 Mana;
|
||||
/*010*/ Convert::SpellBuff_Struct Buffs[BUFF_COUNT];
|
||||
/*510*/ uint32 Items[_MaterialCount];
|
||||
/*546*/ char Name[64];
|
||||
/*610*/
|
||||
};
|
||||
|
||||
struct PlayerProfile_Struct {
|
||||
/*0000*/ uint32 checksum; // Checksum from CRC32::SetEQChecksum
|
||||
/*0004*/ char name[64]; // Name of player sizes not right
|
||||
/*0068*/ char last_name[32]; // Last name of player sizes not right
|
||||
/*0100*/ uint32 gender; // Player Gender - 0 Male, 1 Female
|
||||
/*0104*/ uint32 race; // Player race
|
||||
/*0108*/ uint32 class_; // Player class
|
||||
/*0112*/ uint32 unknown0112; //
|
||||
/*0116*/ uint32 level; // Level of player (might be one byte)
|
||||
/*0120*/ Convert::BindStruct binds[5]; // Bind points (primary is first, home city is fifth)
|
||||
/*0220*/ uint32 deity; // deity
|
||||
/*0224*/ uint32 guild_id;
|
||||
/*0228*/ uint32 birthday; // characters bday
|
||||
/*0232*/ uint32 lastlogin; // last login or zone time
|
||||
/*0236*/ uint32 timePlayedMin; // in minutes
|
||||
/*0240*/ uint8 pvp;
|
||||
/*0241*/ uint8 level2; //no idea why this is here, but thats how it is on live
|
||||
/*0242*/ uint8 anon; // 2=roleplay, 1=anon, 0=not anon
|
||||
/*0243*/ uint8 gm;
|
||||
/*0244*/ uint8 guildrank;
|
||||
/*0245*/ uint8 guildbanker;
|
||||
/*0246*/ uint8 unknown0246[6]; //
|
||||
/*0252*/ uint32 intoxication;
|
||||
/*0256*/ uint32 spellSlotRefresh[MAX_PP_REF_MEMSPELL]; //in ms
|
||||
/*0292*/ uint32 abilitySlotRefresh;
|
||||
/*0296*/ uint8 haircolor; // Player hair color
|
||||
/*0297*/ uint8 beardcolor; // Player beard color
|
||||
/*0298*/ uint8 eyecolor1; // Player left eye color
|
||||
/*0299*/ uint8 eyecolor2; // Player right eye color
|
||||
/*0300*/ uint8 hairstyle; // Player hair style
|
||||
/*0301*/ uint8 beard; // Beard type
|
||||
/*0302*/ uint8 ability_time_seconds; //The following four spots are unknown right now.....
|
||||
/*0303*/ uint8 ability_number; //ability used
|
||||
/*0304*/ uint8 ability_time_minutes;
|
||||
/*0305*/ uint8 ability_time_hours; //place holder
|
||||
/*0306*/ uint8 unknown0306[6]; // @bp Spacer/Flag?
|
||||
/*0312*/ uint32 item_material[_MaterialCount]; // Item texture/material of worn/held items
|
||||
/*0348*/ uint8 unknown0348[44];
|
||||
/*0392*/ Convert::Color_Struct item_tint[_MaterialCount];
|
||||
/*0428*/ Convert::AA_Array aa_array[MAX_PP_AA_ARRAY];
|
||||
/*2348*/ float unknown2384; //seen ~128, ~47
|
||||
/*2352*/ char servername[32]; // length probably not right
|
||||
/*2384*/ char title[32]; // length might be wrong
|
||||
/*2416*/ char suffix[32]; // length might be wrong
|
||||
/*2448*/ uint32 guildid2; //
|
||||
/*2452*/ uint32 exp; // Current Experience
|
||||
/*2456*/ uint32 unknown2492;
|
||||
/*2460*/ uint32 points; // Unspent Practice points
|
||||
/*2464*/ uint32 mana; // current mana
|
||||
/*2468*/ uint32 cur_hp; // current hp
|
||||
/*2472*/ uint32 unknown2508; // 0x05
|
||||
/*2476*/ uint32 STR; // Strength
|
||||
/*2480*/ uint32 STA; // Stamina
|
||||
/*2484*/ uint32 CHA; // Charisma
|
||||
/*2488*/ uint32 DEX; // Dexterity
|
||||
/*2492*/ uint32 INT; // Intelligence
|
||||
/*2496*/ uint32 AGI; // Agility
|
||||
/*2500*/ uint32 WIS; // Wisdom
|
||||
/*2504*/ uint8 face; // Player face
|
||||
/*2505*/ uint8 unknown2541[47]; // ?
|
||||
/*2552*/ uint8 languages[MAX_PP_LANGUAGE];
|
||||
/*2580*/ uint8 unknown2616[4];
|
||||
/*2584*/ uint32 spell_book[MAX_PP_REF_SPELLBOOK];
|
||||
/*4504*/ uint8 unknown4540[128]; // Was [428] all 0xff
|
||||
/*4632*/ uint32 mem_spells[MAX_PP_REF_MEMSPELL];
|
||||
/*4668*/ uint8 unknown4704[32]; //
|
||||
/*4700*/ float y; // Player y position
|
||||
/*4704*/ float x; // Player x position
|
||||
/*4708*/ float z; // Player z position
|
||||
/*4712*/ float heading; // Direction player is facing
|
||||
/*4716*/ uint8 unknown4752[4]; //
|
||||
/*4720*/ int32 platinum; // Platinum Pieces on player
|
||||
/*4724*/ int32 gold; // Gold Pieces on player
|
||||
/*4728*/ int32 silver; // Silver Pieces on player
|
||||
/*4732*/ int32 copper; // Copper Pieces on player
|
||||
/*4736*/ int32 platinum_bank; // Platinum Pieces in Bank
|
||||
/*4740*/ int32 gold_bank; // Gold Pieces in Bank
|
||||
/*4744*/ int32 silver_bank; // Silver Pieces in Bank
|
||||
/*4748*/ int32 copper_bank; // Copper Pieces in Bank
|
||||
/*4752*/ int32 platinum_cursor; // Platinum on cursor
|
||||
/*4756*/ int32 gold_cursor; // Gold on cursor
|
||||
/*4760*/ int32 silver_cursor; // Silver on cursor
|
||||
/*4764*/ int32 copper_cursor; // Copper on cursor
|
||||
/*4768*/ int32 platinum_shared; // Platinum shared between characters
|
||||
/*4772*/ uint8 unknown4808[24];
|
||||
/*4796*/ uint32 skills[MAX_PP_SKILL]; // [400] List of skills // 100 dword buffer
|
||||
/*5196*/ uint8 unknown5132[184];
|
||||
/*5380*/ uint32 pvp2; //
|
||||
/*5384*/ uint32 unknown5420; //
|
||||
/*5388*/ uint32 pvptype; //
|
||||
/*5392*/ uint32 unknown5428; //
|
||||
/*5396*/ uint32 ability_down; // Guessing
|
||||
/*5400*/ uint8 unknown5436[8]; //
|
||||
/*5408*/ uint32 autosplit; //not used right now
|
||||
/*5412*/ uint8 unknown5448[8];
|
||||
/*5420*/ uint32 zone_change_count; // Number of times user has zoned in their career (guessing)
|
||||
/*5424*/ uint8 unknown5460[16]; //
|
||||
/*5440*/ uint32 drakkin_heritage; //
|
||||
/*5444*/ uint32 drakkin_tattoo; //
|
||||
/*5448*/ uint32 drakkin_details; //
|
||||
/*5452*/ uint32 expansions; // expansion setting, bit field of expansions avaliable
|
||||
/*5456*/ int32 toxicity; //from drinking potions, seems to increase by 3 each time you drink
|
||||
/*5460*/ char unknown5496[16]; //
|
||||
/*5476*/ int32 hunger_level;
|
||||
/*5480*/ int32 thirst_level;
|
||||
/*5484*/ uint32 ability_up;
|
||||
/*5488*/ char unknown5524[16];
|
||||
/*5504*/ uint16 zone_id; // Current zone of the player
|
||||
/*5506*/ uint16 zoneInstance; // Instance ID
|
||||
/*5508*/ Convert::SpellBuff_Struct buffs[BUFF_COUNT]; // Buffs currently on the player
|
||||
/*6008*/ char groupMembers[6][64];//
|
||||
/*6392*/ char unknown6428[656];
|
||||
/*7048*/ uint32 entityid;
|
||||
/*7052*/ uint32 leadAAActive;
|
||||
/*7056*/ uint32 unknown7092;
|
||||
/*7060*/ int32 ldon_points_guk; //client uses these as signed
|
||||
/*7064*/ int32 ldon_points_mir;
|
||||
/*7068*/ int32 ldon_points_mmc;
|
||||
/*7072*/ int32 ldon_points_ruj;
|
||||
/*7076*/ int32 ldon_points_tak;
|
||||
/*7080*/ int32 ldon_points_available;
|
||||
/*7084*/ int32 ldon_wins_guk;
|
||||
/*7088*/ int32 ldon_wins_mir;
|
||||
/*7092*/ int32 ldon_wins_mmc;
|
||||
/*7096*/ int32 ldon_wins_ruj;
|
||||
/*7100*/ int32 ldon_wins_tak;
|
||||
/*7104*/ int32 ldon_losses_guk;
|
||||
/*7108*/ int32 ldon_losses_mir;
|
||||
/*7112*/ int32 ldon_losses_mmc;
|
||||
/*7116*/ int32 ldon_losses_ruj;
|
||||
/*7120*/ int32 ldon_losses_tak;
|
||||
/*7124*/ uint8 unknown7160[72];
|
||||
/*7196*/ uint32 tribute_time_remaining; //in miliseconds
|
||||
/*7200*/ uint32 showhelm;
|
||||
/*7204*/ uint32 career_tribute_points;
|
||||
/*7208*/ uint32 unknown7244;
|
||||
/*7212*/ uint32 tribute_points;
|
||||
/*7216*/ uint32 unknown7252;
|
||||
/*7220*/ uint32 tribute_active; //1=active
|
||||
/*7224*/ Convert::Tribute_Struct tributes[EmuConstants::TRIBUTE_SIZE];
|
||||
/*7264*/ Convert::Disciplines_Struct disciplines;
|
||||
/*7664*/ uint32 recastTimers[MAX_RECAST_TYPES]; // Timers (GMT of last use)
|
||||
/*7744*/ char unknown7780[160];
|
||||
/*7904*/ uint32 endurance;
|
||||
/*7908*/ uint32 group_leadership_exp; //0-1000
|
||||
/*7912*/ uint32 raid_leadership_exp; //0-2000
|
||||
/*7916*/ uint32 group_leadership_points;
|
||||
/*7920*/ uint32 raid_leadership_points;
|
||||
/*7924*/ Convert::LeadershipAA_Struct leader_abilities;
|
||||
/*8052*/ uint8 unknown8088[132];
|
||||
/*8184*/ uint32 air_remaining;
|
||||
/*8188*/ uint32 PVPKills;
|
||||
/*8192*/ uint32 PVPDeaths;
|
||||
/*8196*/ uint32 PVPCurrentPoints;
|
||||
/*8200*/ uint32 PVPCareerPoints;
|
||||
/*8204*/ uint32 PVPBestKillStreak;
|
||||
/*8208*/ uint32 PVPWorstDeathStreak;
|
||||
/*8212*/ uint32 PVPCurrentKillStreak;
|
||||
/*8216*/ Convert::PVPStatsEntry_Struct PVPLastKill;
|
||||
/*8304*/ Convert::PVPStatsEntry_Struct PVPLastDeath;
|
||||
/*8392*/ uint32 PVPNumberOfKillsInLast24Hours;
|
||||
/*8396*/ Convert::PVPStatsEntry_Struct PVPRecentKills[50];
|
||||
/*12796*/ uint32 aapoints_spent;
|
||||
/*12800*/ uint32 expAA;
|
||||
/*12804*/ uint32 aapoints; //avaliable, unspent
|
||||
/*12808*/ uint8 unknown12844[36];
|
||||
/*12844*/ Convert::Bandolier_Struct bandoliers[EmuConstants::BANDOLIERS_COUNT];
|
||||
/*14124*/ uint8 unknown14160[4506];
|
||||
/*18630*/ Convert::SuspendedMinion_Struct SuspendedMinion; // No longer in use
|
||||
/*19240*/ uint32 timeentitledonaccount;
|
||||
/*19244*/ Convert::PotionBelt_Struct potionbelt; //there should be 3 more of these
|
||||
/*19532*/ uint8 unknown19568[8];
|
||||
/*19540*/ uint32 currentRadCrystals; // Current count of radiant crystals
|
||||
/*19544*/ uint32 careerRadCrystals; // Total count of radiant crystals ever
|
||||
/*19548*/ uint32 currentEbonCrystals;// Current count of ebon crystals
|
||||
/*19552*/ uint32 careerEbonCrystals; // Total count of ebon crystals ever
|
||||
/*19556*/ uint8 groupAutoconsent; // 0=off, 1=on
|
||||
/*19557*/ uint8 raidAutoconsent; // 0=off, 1=on
|
||||
/*19558*/ uint8 guildAutoconsent; // 0=off, 1=on
|
||||
/*19559*/ uint8 unknown19595[5]; // ***Placeholder (6/29/2005)
|
||||
/*19564*/ uint32 RestTimer;
|
||||
/*19568*/
|
||||
};
|
||||
|
||||
|
||||
namespace player_lootitem_temp
|
||||
{
|
||||
struct ServerLootItem_Struct_temp {
|
||||
uint32 item_id;
|
||||
int16 equipSlot;
|
||||
uint8 charges;
|
||||
uint16 lootslot;
|
||||
uint32 aug1;
|
||||
uint32 aug2;
|
||||
uint32 aug3;
|
||||
uint32 aug4;
|
||||
uint32 aug5;
|
||||
};
|
||||
}
|
||||
|
||||
struct DBPlayerCorpse_Struct_temp {
|
||||
uint32 crc;
|
||||
bool locked;
|
||||
uint32 itemcount;
|
||||
uint32 exp;
|
||||
float size;
|
||||
uint8 level;
|
||||
uint8 race;
|
||||
uint8 gender;
|
||||
uint8 class_;
|
||||
uint8 deity;
|
||||
uint8 texture;
|
||||
uint8 helmtexture;
|
||||
uint32 copper;
|
||||
uint32 silver;
|
||||
uint32 gold;
|
||||
uint32 plat;
|
||||
Color_Struct item_tint[9];
|
||||
uint8 haircolor;
|
||||
uint8 beardcolor;
|
||||
uint8 eyecolor1;
|
||||
uint8 eyecolor2;
|
||||
uint8 hairstyle;
|
||||
uint8 face;
|
||||
uint8 beard;
|
||||
uint32 drakkin_heritage;
|
||||
uint32 drakkin_tattoo;
|
||||
uint32 drakkin_details;
|
||||
player_lootitem_temp::ServerLootItem_Struct_temp items[0];
|
||||
};
|
||||
|
||||
namespace classic_db_temp {
|
||||
struct DBPlayerCorpse_Struct_temp {
|
||||
uint32 crc;
|
||||
bool locked;
|
||||
uint32 itemcount;
|
||||
uint32 exp;
|
||||
float size;
|
||||
uint8 level;
|
||||
uint8 race;
|
||||
uint8 gender;
|
||||
uint8 class_;
|
||||
uint8 deity;
|
||||
uint8 texture;
|
||||
uint8 helmtexture;
|
||||
uint32 copper;
|
||||
uint32 silver;
|
||||
uint32 gold;
|
||||
uint32 plat;
|
||||
Color_Struct item_tint[9];
|
||||
uint8 haircolor;
|
||||
uint8 beardcolor;
|
||||
uint8 eyecolor1;
|
||||
uint8 eyecolor2;
|
||||
uint8 hairstyle;
|
||||
uint8 face;
|
||||
uint8 beard;
|
||||
player_lootitem_temp::ServerLootItem_Struct_temp items[0];
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#pragma pack()
|
||||
|
||||
class Database : public DBcore {
|
||||
public:
|
||||
Database();
|
||||
Database(const char* host, const char* user, const char* passwd, const char* database,uint32 port);
|
||||
bool Connect(const char* host, const char* user, const char* passwd, const char* database,uint32 port);
|
||||
~Database();
|
||||
bool ThrowDBError(std::string ErrorMessage, std::string query_title, std::string query);
|
||||
|
||||
|
||||
/*
|
||||
@ -221,7 +625,11 @@ public:
|
||||
void SetRaidGroupLeaderInfo(uint32 gid, uint32 rid);
|
||||
void ClearRaidLeader(uint32 gid = 0xFFFFFFFF, uint32 rid = 0);
|
||||
|
||||
bool CheckDatabaseConversions();
|
||||
/* Database Conversions*/
|
||||
bool CheckDatabaseConversions();
|
||||
bool CheckDatabaseConvertPPDeblob();
|
||||
bool CheckDatabaseConvertCorpseDeblob();
|
||||
bool CheckDatabaseConvertBotsPostPPDeblob();
|
||||
|
||||
/*
|
||||
* Database Variables
|
||||
|
||||
@ -4,6 +4,7 @@
|
||||
#include <winsock2.h>
|
||||
#endif
|
||||
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
#include <errmsg.h>
|
||||
#include <mysqld_error.h>
|
||||
@ -113,6 +114,16 @@ MySQLRequestResult DBcore::QueryDatabase(const char* query, uint32 querylen, boo
|
||||
#ifdef _EQDEBUG
|
||||
std::cout << "DB Query Error #" << mysql_errno(&mysql) << ": " << mysql_error(&mysql) << std::endl;
|
||||
#endif
|
||||
|
||||
/* Implement Logging at the Root */
|
||||
if (mysql_errno(&mysql) > 0 && strlen(query) > 0){
|
||||
std::cout << "\n[MYSQL ERR] " << mysql_errno(&mysql) << ": " << mysql_error(&mysql) << " [Query]: \n" << query << "\n" << std::endl;
|
||||
/* Write to log file */
|
||||
std::ofstream log("eqemu_query_error_log.txt", std::ios_base::app | std::ios_base::out);
|
||||
log << "[MYSQL ERR] " << mysql_error(&mysql) << "\n" << query << "\n";
|
||||
log.close();
|
||||
}
|
||||
|
||||
return MySQLRequestResult(nullptr, 0, 0, 0, 0, mysql_errno(&mysql),errorBuffer);
|
||||
|
||||
}
|
||||
@ -126,7 +137,6 @@ MySQLRequestResult DBcore::QueryDatabase(const char* query, uint32 querylen, boo
|
||||
|
||||
MySQLRequestResult requestResult(res, (uint32)mysql_affected_rows(&mysql), rowCount, (uint32)mysql_field_count(&mysql), (uint32)mysql_insert_id(&mysql));
|
||||
|
||||
|
||||
#if DEBUG_MYSQL_QUERIES >= 1
|
||||
if (requestResult.Success())
|
||||
{
|
||||
@ -145,95 +155,6 @@ MySQLRequestResult DBcore::QueryDatabase(const char* query, uint32 querylen, boo
|
||||
return requestResult;
|
||||
}
|
||||
|
||||
bool DBcore::RunQuery(const char* query, uint32 querylen, char* errbuf, MYSQL_RES** result, uint32* affected_rows, uint32* last_insert_id, uint32* errnum, bool retry) {
|
||||
if (errnum)
|
||||
*errnum = 0;
|
||||
if (errbuf)
|
||||
errbuf[0] = 0;
|
||||
bool ret = false;
|
||||
LockMutex lock(&MDatabase);
|
||||
if (pStatus != Connected)
|
||||
Open();
|
||||
|
||||
if (mysql_real_query(&mysql, query, querylen)) {
|
||||
if (mysql_errno(&mysql) == CR_SERVER_GONE_ERROR)
|
||||
pStatus = Error;
|
||||
if (mysql_errno(&mysql) == CR_SERVER_LOST || mysql_errno(&mysql) == CR_SERVER_GONE_ERROR) {
|
||||
if (retry) {
|
||||
std::cout << "Database Error: Lost connection, attempting to recover...." << std::endl;
|
||||
ret = RunQuery(query, querylen, errbuf, result, affected_rows, last_insert_id, errnum, false);
|
||||
if (ret)
|
||||
std::cout << "Reconnection to database successful." << std::endl;
|
||||
}
|
||||
else {
|
||||
pStatus = Error;
|
||||
if (errnum)
|
||||
*errnum = mysql_errno(&mysql);
|
||||
if (errbuf)
|
||||
snprintf(errbuf, MYSQL_ERRMSG_SIZE, "#%i: %s", mysql_errno(&mysql), mysql_error(&mysql));
|
||||
std::cout << "DB Query Error #" << mysql_errno(&mysql) << ": " << mysql_error(&mysql) << std::endl;
|
||||
ret = false;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (errnum)
|
||||
*errnum = mysql_errno(&mysql);
|
||||
if (errbuf)
|
||||
snprintf(errbuf, MYSQL_ERRMSG_SIZE, "#%i: %s", mysql_errno(&mysql), mysql_error(&mysql));
|
||||
#ifdef _EQDEBUG
|
||||
std::cout << "DB Query Error #" << mysql_errno(&mysql) << ": " << mysql_error(&mysql) << std::endl;
|
||||
#endif
|
||||
ret = false;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (result && mysql_field_count(&mysql)) {
|
||||
*result = mysql_store_result(&mysql);
|
||||
#ifdef _EQDEBUG
|
||||
DBMemLeak::Alloc(*result, query);
|
||||
#endif
|
||||
}
|
||||
else if (result)
|
||||
*result = 0;
|
||||
if (affected_rows)
|
||||
*affected_rows = mysql_affected_rows(&mysql);
|
||||
if (last_insert_id)
|
||||
*last_insert_id = (uint32)mysql_insert_id(&mysql);
|
||||
if (result) {
|
||||
if (*result) {
|
||||
ret = true;
|
||||
}
|
||||
else {
|
||||
#ifdef _EQDEBUG
|
||||
std::cout << "DB Query Error: No Result" << std::endl;
|
||||
#endif
|
||||
if (errnum)
|
||||
*errnum = UINT_MAX;
|
||||
if (errbuf)
|
||||
strcpy(errbuf, "DBcore::RunQuery: No Result");
|
||||
ret = false;
|
||||
}
|
||||
}
|
||||
else {
|
||||
ret = true;
|
||||
}
|
||||
}
|
||||
#if DEBUG_MYSQL_QUERIES >= 1
|
||||
if (ret) {
|
||||
std::cout << "query successful";
|
||||
if (result && (*result))
|
||||
std::cout << ", " << (int) mysql_num_rows(*result) << " rows returned";
|
||||
if (affected_rows)
|
||||
std::cout << ", " << (*affected_rows) << " rows affected";
|
||||
std::cout<< std::endl;
|
||||
}
|
||||
else {
|
||||
std::cout << "QUERY: query FAILED" << std::endl;
|
||||
}
|
||||
#endif
|
||||
return ret;
|
||||
}
|
||||
|
||||
void DBcore::TransactionBegin() {
|
||||
QueryDatabase("START TRANSACTION");
|
||||
}
|
||||
|
||||
@ -23,7 +23,6 @@ public:
|
||||
DBcore();
|
||||
~DBcore();
|
||||
eStatus GetStatus() { return pStatus; }
|
||||
bool RunQuery(const char* query, uint32 querylen, char* errbuf = 0, MYSQL_RES** result = 0, uint32* affected_rows = 0, uint32* last_insert_id = 0, uint32* errnum = 0, bool retry = true);
|
||||
MySQLRequestResult QueryDatabase(const char* query, uint32 querylen, bool retryOnFailureOnce = true);
|
||||
MySQLRequestResult QueryDatabase(std::string query, bool retryOnFailureOnce = true);
|
||||
void TransactionBegin();
|
||||
|
||||
@ -5209,17 +5209,17 @@ struct MercenaryMerchantResponse_Struct {
|
||||
};
|
||||
|
||||
struct ServerLootItem_Struct {
|
||||
uint32 item_id;
|
||||
int16 equipSlot;
|
||||
uint8 charges;
|
||||
uint16 lootslot;
|
||||
uint32 aug1;
|
||||
uint32 aug2;
|
||||
uint32 aug3;
|
||||
uint32 aug4;
|
||||
uint32 aug5;
|
||||
uint8 minlevel;
|
||||
uint8 maxlevel;
|
||||
uint32 item_id; // uint32 item_id;
|
||||
int16 equip_slot; // int16 equip_slot;
|
||||
uint16 charges; // uint8 charges;
|
||||
uint16 lootslot; // uint16 lootslot;
|
||||
uint32 aug_1; // uint32 aug_1;
|
||||
uint32 aug_2; // uint32 aug_2;
|
||||
uint32 aug_3; // uint32 aug_3;
|
||||
uint32 aug_4; // uint32 aug_4;
|
||||
uint32 aug_5; // uint32 aug_5;
|
||||
uint8 min_level; //
|
||||
uint8 max_level; //
|
||||
};
|
||||
|
||||
//Found in client near a ref to the string:
|
||||
|
||||
@ -1215,11 +1215,11 @@ ItemInst* SharedDatabase::CreateBaseItem(const Item_Struct* item, int16 charges)
|
||||
}
|
||||
|
||||
int32 SharedDatabase::DeleteStalePlayerCorpses() {
|
||||
if(RuleB(Zone, EnableShadowrest))
|
||||
{
|
||||
std::string query = StringFormat("UPDATE player_corpses SET IsBurried = 1 WHERE IsBurried = 0 AND "
|
||||
"(UNIX_TIMESTAMP() - UNIX_TIMESTAMP(timeofdeath)) > %d AND NOT timeofdeath = 0",
|
||||
(RuleI(Character, CorpseDecayTimeMS) / 1000));
|
||||
if(RuleB(Zone, EnableShadowrest)) {
|
||||
std::string query = StringFormat(
|
||||
"UPDATE `character_corpses` SET `is_buried` = 1 WHERE `is_buried` = 0 AND "
|
||||
"(UNIX_TIMESTAMP() - UNIX_TIMESTAMP(time_of_death)) > %d AND NOT time_of_death = 0",
|
||||
(RuleI(Character, CorpseDecayTimeMS) / 1000));
|
||||
auto results = QueryDatabase(query);
|
||||
if (!results.Success())
|
||||
return -1;
|
||||
@ -1227,8 +1227,9 @@ int32 SharedDatabase::DeleteStalePlayerCorpses() {
|
||||
return results.RowsAffected();
|
||||
}
|
||||
|
||||
std::string query = StringFormat("DELETE FROM player_corpses WHERE (UNIX_TIMESTAMP() - UNIX_TIMESTAMP(timeofdeath)) > %d "
|
||||
"AND NOT timeofdeath = 0", (RuleI(Character, CorpseDecayTimeMS) / 1000));
|
||||
std::string query = StringFormat(
|
||||
"DELETE FROM `character_corpses` WHERE (UNIX_TIMESTAMP() - UNIX_TIMESTAMP(time_of_death)) > %d "
|
||||
"AND NOT time_of_death = 0", (RuleI(Character, CorpseDecayTimeMS) / 1000));
|
||||
auto results = QueryDatabase(query);
|
||||
if (!results.Success())
|
||||
return -1;
|
||||
@ -1236,16 +1237,6 @@ int32 SharedDatabase::DeleteStalePlayerCorpses() {
|
||||
return results.RowsAffected();
|
||||
}
|
||||
|
||||
int32 SharedDatabase::DeleteStalePlayerBackups() {
|
||||
// 1209600 seconds = 2 weeks
|
||||
const std::string query = "DELETE FROM player_corpses_backup WHERE (UNIX_TIMESTAMP() - UNIX_TIMESTAMP(timeofdeath)) > 1209600";
|
||||
auto results = QueryDatabase(query);
|
||||
if (!results.Success())
|
||||
return -1;
|
||||
|
||||
return results.RowsAffected();
|
||||
}
|
||||
|
||||
bool SharedDatabase::GetCommandSettings(std::map<std::string,uint8> &commands) {
|
||||
|
||||
const std::string query = "SELECT command, access FROM commands";
|
||||
@ -1915,7 +1906,7 @@ const LootDrop_Struct* SharedDatabase::GetLootDrop(uint32 lootdrop_id) {
|
||||
|
||||
void SharedDatabase::LoadCharacterInspectMessage(uint32 character_id, InspectMessage_Struct* message) {
|
||||
std::string query = StringFormat("SELECT `inspect_message` FROM `character_inspect_messages` WHERE `id` = %u LIMIT 1", character_id);
|
||||
auto results = QueryDatabase(query); ThrowDBError(results.ErrorMessage(), "SharedDatabase::LoadCharacterInspectMessage", query);
|
||||
auto results = QueryDatabase(query);
|
||||
auto row = results.begin();
|
||||
memcpy(message, "", sizeof(InspectMessage_Struct));
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
@ -1925,7 +1916,7 @@ void SharedDatabase::LoadCharacterInspectMessage(uint32 character_id, InspectMes
|
||||
|
||||
void SharedDatabase::SaveCharacterInspectMessage(uint32 character_id, const InspectMessage_Struct* message) {
|
||||
std::string query = StringFormat("REPLACE INTO `character_inspect_messages` (id, inspect_message) VALUES (%u, '%s')", character_id, EscapeString(message->text).c_str());
|
||||
auto results = QueryDatabase(query); ThrowDBError(results.ErrorMessage(), "SharedDatabase::SaveCharacterInspectMessage", query);
|
||||
auto results = QueryDatabase(query);
|
||||
}
|
||||
|
||||
void SharedDatabase::GetBotInspectMessage(uint32 botid, InspectMessage_Struct* message) {
|
||||
|
||||
@ -41,7 +41,6 @@ public:
|
||||
uint8 GetGMSpeed(uint32 account_id);
|
||||
bool SetHideMe(uint32 account_id, uint8 hideme);
|
||||
int32 DeleteStalePlayerCorpses();
|
||||
int32 DeleteStalePlayerBackups();
|
||||
void LoadCharacterInspectMessage(uint32 character_id, InspectMessage_Struct* message);
|
||||
void SaveCharacterInspectMessage(uint32 character_id, const InspectMessage_Struct* message);
|
||||
void GetBotInspectMessage(uint32 botid, InspectMessage_Struct* message);
|
||||
|
||||
@ -0,0 +1 @@
|
||||
INSERT INTO `rule_values` (`ruleset_id`, `rule_name`, `rule_value`, `notes`) VALUES (1, 'NPC:EnableMeritBasedFaction', 'false', 'If set to true, faction will given in the same way as experience (solo/group/raid).');
|
||||
@ -376,7 +376,7 @@ void Adventure::MoveCorpsesToGraveyard()
|
||||
std::list<uint32> dbid_list;
|
||||
std::list<uint32> charid_list;
|
||||
|
||||
std::string query = StringFormat("SELECT id, charid FROM player_corpses WHERE instanceid=%d", GetInstanceID());
|
||||
std::string query = StringFormat("SELECT id, charid FROM character_corpses WHERE instanceid=%d", GetInstanceID());
|
||||
auto results = database.QueryDatabase(query);
|
||||
if(!results.Success())
|
||||
LogFile->write(EQEMuLog::Error, "Error in AdventureManager:::MoveCorpsesToGraveyard: %s (%s)", query.c_str(), results.ErrorMessage().c_str());
|
||||
@ -392,7 +392,7 @@ void Adventure::MoveCorpsesToGraveyard()
|
||||
float y = GetTemplate()->graveyard_y + MakeRandomFloat(-GetTemplate()->graveyard_radius, GetTemplate()->graveyard_radius);
|
||||
float z = GetTemplate()->graveyard_z;
|
||||
|
||||
query = StringFormat("UPDATE player_corpses "
|
||||
query = StringFormat("UPDATE character_corpses "
|
||||
"SET zoneid = %d, instanceid = 0, "
|
||||
"x = %f, y = %f, z = %f WHERE instanceid = %d",
|
||||
GetTemplate()->graveyard_zone_id,
|
||||
|
||||
@ -336,9 +336,6 @@ int main(int argc, char** argv) {
|
||||
_log(WORLD__INIT, "Reboot zone modes %s",holdzones ? "ON" : "OFF");
|
||||
|
||||
_log(WORLD__INIT, "Deleted %i stale player corpses from database", database.DeleteStalePlayerCorpses());
|
||||
if (RuleB(World, DeleteStaleCorpeBackups) == true) {
|
||||
_log(WORLD__INIT, "Deleted %i stale player backups from database", database.DeleteStalePlayerBackups());
|
||||
}
|
||||
|
||||
_log(WORLD__INIT, "Loading adventures...");
|
||||
if(!adventure_manager.LoadAdventureTemplates())
|
||||
|
||||
@ -142,14 +142,14 @@ void WorldDatabase::GetCharSelectInfo(uint32 account_id, CharacterSelect_Struct*
|
||||
std::string query = StringFormat("REPLACE INTO `character_bind` (id, zone_id, instance_id, x, y, z, heading, is_home)"
|
||||
" VALUES (%u, %u, %u, %f, %f, %f, %f, %i)",
|
||||
character_id, pp.binds[4].zoneId, 0, pp.binds[4].x, pp.binds[4].y, pp.binds[4].z, pp.binds[4].heading, 1);
|
||||
auto results_bset = QueryDatabase(query); ThrowDBError(results_bset.ErrorMessage(), "WorldDatabase::GetCharSelectInfo Set Home Point", query);
|
||||
auto results_bset = QueryDatabase(query);
|
||||
}
|
||||
/* If no regular bind set, set it */
|
||||
if (has_bind == 0){
|
||||
std::string query = StringFormat("REPLACE INTO `character_bind` (id, zone_id, instance_id, x, y, z, heading, is_home)"
|
||||
" VALUES (%u, %u, %u, %f, %f, %f, %f, %i)",
|
||||
character_id, pp.binds[0].zoneId, 0, pp.binds[0].x, pp.binds[0].y, pp.binds[0].z, pp.binds[0].heading, 0);
|
||||
auto results_bset = QueryDatabase(query); ThrowDBError(results_bset.ErrorMessage(), "WorldDatabase::GetCharSelectInfo Set Bind Point", query);
|
||||
auto results_bset = QueryDatabase(query);
|
||||
}
|
||||
}
|
||||
/* Bind End */
|
||||
|
||||
@ -2582,38 +2582,6 @@ void Client::LogMerchant(Client* player, Mob* merchant, uint32 quantity, uint32
|
||||
}
|
||||
}
|
||||
|
||||
void Client::LogLoot(Client* player, Corpse* corpse, const Item_Struct* item){
|
||||
char* logtext;
|
||||
char itemid[100];
|
||||
char itemname[100];
|
||||
char coinloot[100];
|
||||
if (item!=0){
|
||||
memset(itemid,0,sizeof(itemid));
|
||||
memset(itemname,0,sizeof(itemid));
|
||||
itoa(item->ID,itemid,10);
|
||||
sprintf(itemname,"%s",item->Name);
|
||||
logtext=itemname;
|
||||
|
||||
strcat(logtext,"(");
|
||||
strcat(logtext,itemid);
|
||||
strcat(logtext,") Looted");
|
||||
database.logevents(player->AccountName(),player->AccountID(),player->admin,player->GetName(),corpse->orgname,"Looting Item",logtext,4);
|
||||
}
|
||||
else{
|
||||
if ((corpse->GetPlatinum() + corpse->GetGold() + corpse->GetSilver() + corpse->GetCopper())>0) {
|
||||
memset(coinloot,0,sizeof(coinloot));
|
||||
sprintf(coinloot,"%i PP %i GP %i SP %i CP",corpse->GetPlatinum(),corpse->GetGold(),corpse->GetSilver(),corpse->GetCopper());
|
||||
logtext=coinloot;
|
||||
strcat(logtext," Looted");
|
||||
if (corpse->GetPlatinum()>10000)
|
||||
database.logevents(player->AccountName(),player->AccountID(),player->admin,player->GetName(),corpse->orgname,"Excessive Loot!",logtext,9);
|
||||
else
|
||||
database.logevents(player->AccountName(),player->AccountID(),player->admin,player->GetName(),corpse->orgname,"Looting Money",logtext,5);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool Client::BindWound(Mob* bindmob, bool start, bool fail){
|
||||
EQApplicationPacket* outapp = 0;
|
||||
if(!fail) {
|
||||
@ -4969,7 +4937,7 @@ void Client::SummonAndRezzAllCorpses()
|
||||
|
||||
entity_list.RemoveAllCorpsesByCharID(CharacterID());
|
||||
|
||||
int CorpseCount = database.SummonAllPlayerCorpses(CharacterID(), zone->GetZoneID(), zone->GetInstanceID(),
|
||||
int CorpseCount = database.SummonAllCharacterCorpses(CharacterID(), zone->GetZoneID(), zone->GetInstanceID(),
|
||||
GetX(), GetY(), GetZ(), GetHeading());
|
||||
if(CorpseCount <= 0)
|
||||
{
|
||||
@ -5007,7 +4975,7 @@ void Client::SummonAllCorpses(float dest_x, float dest_y, float dest_z, float de
|
||||
|
||||
entity_list.RemoveAllCorpsesByCharID(CharacterID());
|
||||
|
||||
int CorpseCount = database.SummonAllPlayerCorpses(CharacterID(), zone->GetZoneID(), zone->GetInstanceID(),
|
||||
int CorpseCount = database.SummonAllCharacterCorpses(CharacterID(), zone->GetZoneID(), zone->GetInstanceID(),
|
||||
dest_x, dest_y, dest_z, dest_heading);
|
||||
if(CorpseCount <= 0)
|
||||
{
|
||||
@ -5051,7 +5019,7 @@ void Client::DepopPlayerCorpse(uint32 dbid)
|
||||
|
||||
void Client::BuryPlayerCorpses()
|
||||
{
|
||||
database.BuryAllPlayerCorpses(CharacterID());
|
||||
database.BuryAllCharacterCorpses(CharacterID());
|
||||
}
|
||||
|
||||
void Client::NotifyNewTitlesAvailable()
|
||||
|
||||
@ -335,7 +335,6 @@ public:
|
||||
bool CheckAccess(int16 iDBLevel, int16 iDefaultLevel);
|
||||
|
||||
void CheckQuests(const char* zonename, const char* message, uint32 npc_id, uint32 item_id, Mob* other);
|
||||
void LogLoot(Client* player,Corpse* corpse,const Item_Struct* item);
|
||||
bool AutoAttackEnabled() const { return auto_attack; }
|
||||
bool AutoFireEnabled() const { return auto_fire; }
|
||||
void MakeCorpse(uint32 exploss);
|
||||
@ -1031,9 +1030,9 @@ void SetConsumption(int32 in_hunger, int32 in_thirst);
|
||||
void DepopAllCorpses();
|
||||
void DepopPlayerCorpse(uint32 dbid);
|
||||
void BuryPlayerCorpses();
|
||||
uint32 GetCorpseCount() { return database.GetPlayerCorpseCount(CharacterID()); }
|
||||
uint32 GetCorpseID(int corpse) { return database.GetPlayerCorpseID(CharacterID(), corpse); }
|
||||
uint32 GetCorpseItemAt(int corpse_id, int slot_id) { return database.GetPlayerCorpseItemAt(corpse_id, slot_id); }
|
||||
uint32 GetCorpseCount() { return database.GetCharacterCorpseCount(CharacterID()); }
|
||||
uint32 GetCorpseID(int corpse) { return database.GetCharacterCorpseID(CharacterID(), corpse); }
|
||||
uint32 GetCorpseItemAt(int corpse_id, int slot_id) { return database.GetCharacterCorpseItemAt(corpse_id, slot_id); }
|
||||
void SuspendMinion();
|
||||
void Doppelganger(uint16 spell_id, Mob *target, const char *name_override, int pet_count, int pet_duration);
|
||||
void NotifyNewTitlesAvailable();
|
||||
|
||||
@ -4827,7 +4827,7 @@ void Client::Handle_OP_ConsiderCorpse(const EQApplicationPacket *app)
|
||||
else
|
||||
Message(0, "This corpse will decay in %i minutes and %i seconds.", min, sec);
|
||||
|
||||
Message(0, "This corpse %s be resurrected.", tcorpse->Rezzed() ? "cannot" : "can");
|
||||
Message(0, "This corpse %s be resurrected.", tcorpse->IsRezzed() ? "cannot" : "can");
|
||||
/*
|
||||
hour = 0;
|
||||
|
||||
@ -6175,8 +6175,8 @@ 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, timeofdeath, rezzed, IsBurried "
|
||||
"FROM player_corpses WheRE charname LIKE '%%%s%%' ORDER BY charname LIMIT %i",
|
||||
std::string query = StringFormat("SELECT charname, zoneid, x, y, z, time_of_death, rezzed, IsBurried "
|
||||
"FROM character_corpses WheRE charname LIKE '%%%s%%' ORDER BY charname LIMIT %i",
|
||||
escSearchString, maxResults);
|
||||
safe_delete_array(escSearchString);
|
||||
auto results = database.QueryDatabase(query);
|
||||
@ -6193,7 +6193,7 @@ void Client::Handle_OP_GMSearchCorpse(const EQApplicationPacket *app)
|
||||
else
|
||||
Message(clientMessageYellow, "There are %i corpse(s) that match the search string '%s'.", results.RowCount(), gmscs->Name);
|
||||
|
||||
char charName[64], timeOfDeath[20];
|
||||
char charName[64], time_of_death[20];
|
||||
|
||||
std::string popupText = "<table><tr><td>Name</td><td>Zone</td><td>X</td><td>Y</td><td>Z</td><td>Date</td><td>"
|
||||
"Rezzed</td><td>Buried</td></tr><tr><td> </td><td></td><td></td><td></td><td></td><td>"
|
||||
@ -6208,13 +6208,13 @@ void Client::Handle_OP_GMSearchCorpse(const EQApplicationPacket *app)
|
||||
float CorpseY = atof(row[3]);
|
||||
float CorpseZ = atof(row[4]);
|
||||
|
||||
strn0cpy(timeOfDeath, row[5], sizeof(timeOfDeath));
|
||||
strn0cpy(time_of_death, row[5], sizeof(time_of_death));
|
||||
|
||||
bool corpseRezzed = atoi(row[6]);
|
||||
bool corpseBuried = atoi(row[7]);
|
||||
|
||||
popupText += StringFormat("<tr><td>%s</td><td>%s</td><td>%8.0f</td><td>%8.0f</td><td>%8.0f</td><td>%s</td><td>%s</td><td>%s</td></tr>",
|
||||
charName, StaticGetZoneName(ZoneID), CorpseX, CorpseY, CorpseZ, timeOfDeath,
|
||||
charName, StaticGetZoneName(ZoneID), CorpseX, CorpseY, CorpseZ, time_of_death,
|
||||
corpseRezzed ? "Yes" : "No", corpseBuried ? "Yes" : "No");
|
||||
|
||||
if (popupText.size() > 4000) {
|
||||
|
||||
@ -2173,7 +2173,7 @@ void Client::HandleRespawnFromHover(uint32 Option)
|
||||
|
||||
_log(SPELLS__REZ, "Found corpse. Marking corpse as rezzed.");
|
||||
|
||||
corpse->Rezzed(true);
|
||||
corpse->IsRezzed(true);
|
||||
corpse->CompleteRezz();
|
||||
}
|
||||
}
|
||||
|
||||
@ -8456,7 +8456,7 @@ void command_setgraveyard(Client *c, const Seperator *sep)
|
||||
zoneid = database.GetZoneID(sep->arg[1]);
|
||||
|
||||
if(zoneid > 0) {
|
||||
graveyard_id = database.NewGraveyardRecord(zoneid, t->GetX(), t->GetY(), t->GetZ(), t->GetHeading());
|
||||
graveyard_id = database.CreateGraveyardRecord(zoneid, t->GetX(), t->GetY(), t->GetZ(), t->GetHeading());
|
||||
|
||||
if(graveyard_id > 0) {
|
||||
c->Message(0, "Successfuly added a new record for this graveyard!");
|
||||
@ -8519,7 +8519,7 @@ void command_summonburriedplayercorpse(Client *c, const Seperator *sep)
|
||||
return;
|
||||
}
|
||||
|
||||
Corpse* PlayerCorpse = database.SummonBurriedPlayerCorpse(t->CharacterID(), t->GetZoneID(), zone->GetInstanceID(), t->GetX(), t->GetY(), t->GetZ(), t->GetHeading());
|
||||
Corpse* PlayerCorpse = database.SummonBuriedCharacterCorpses(t->CharacterID(), t->GetZoneID(), zone->GetInstanceID(), t->GetX(), t->GetY(), t->GetZ(), t->GetHeading());
|
||||
|
||||
if(!PlayerCorpse)
|
||||
c->Message(0, "Your target doesn't have any burried corpses.");
|
||||
@ -8538,7 +8538,7 @@ void command_getplayerburriedcorpsecount(Client *c, const Seperator *sep)
|
||||
return;
|
||||
}
|
||||
|
||||
uint32 CorpseCount = database.GetPlayerBurriedCorpseCount(t->CharacterID());
|
||||
uint32 CorpseCount = database.GetCharacterBuriedCorpseCount(t->CharacterID());
|
||||
|
||||
if(CorpseCount > 0)
|
||||
c->Message(0, "Your target has a total of %u burried corpses.", CorpseCount);
|
||||
|
||||
1535
zone/corpse.cpp
1535
zone/corpse.cpp
File diff suppressed because it is too large
Load Diff
133
zone/corpse.h
133
zone/corpse.h
@ -26,64 +26,64 @@ class NPC;
|
||||
|
||||
#define MAX_LOOTERS 72
|
||||
|
||||
class Corpse : public Mob
|
||||
{
|
||||
class Corpse : public Mob {
|
||||
public:
|
||||
static void SendEndLootErrorPacket(Client* client);
|
||||
static void SendLootReqErrorPacket(Client* client, uint8 response = 2);
|
||||
static Corpse* LoadFromDBData(uint32 in_corpseid, uint32 in_charid, char* in_charname, uchar* in_data, uint32 in_datasize, float in_x, float in_y, float in_z, float in_heading, char* timeofdeath, bool rezzed = false, bool wasAtGraveyard = false);
|
||||
|
||||
static void SendEndLootErrorPacket(Client* client);
|
||||
static void SendLootReqErrorPacket(Client* client, uint8 response = 2);
|
||||
|
||||
Corpse(NPC* in_npc, ItemList* in_itemlist, uint32 in_npctypeid, const NPCType** in_npctypedata, uint32 in_decaytime = 600000);
|
||||
Corpse(Client* client, int32 in_rezexp);
|
||||
Corpse(uint32 in_corpseid, uint32 in_charid, char* in_charname, ItemList* in_itemlist, uint32 in_copper, uint32 in_silver, uint32 in_gold, uint32 in_plat, float in_x, float in_y, float in_z, float in_heading, float in_size, uint8 in_gender, uint16 in_race, uint8 in_class, uint8 in_deity, uint8 in_level, uint8 in_texture, uint8 in_helmtexture,uint32 in_rezexp, bool wasAtGraveyard = false);
|
||||
Corpse(uint32 in_corpseid, uint32 in_charid, const char* in_charname, ItemList* in_itemlist, uint32 in_copper, uint32 in_silver, uint32 in_gold, uint32 in_plat, float in_x, float in_y, float in_z, float in_heading, float in_size, uint8 in_gender, uint16 in_race, uint8 in_class, uint8 in_deity, uint8 in_level, uint8 in_texture, uint8 in_helmtexture, uint32 in_rezexp, bool wasAtGraveyard = false);
|
||||
~Corpse();
|
||||
static Corpse* LoadFromDBData(uint32 in_dbid, uint32 in_charid, std::string in_charname, float in_x, float in_y, float in_z, float in_heading, std::string time_of_death, bool rezzed, bool was_at_graveyard);
|
||||
|
||||
//abstract virtual function implementations requird by base abstract class
|
||||
virtual bool Death(Mob* killerMob, int32 damage, uint16 spell_id, SkillUseTypes attack_skill) { return true; }
|
||||
virtual void Damage(Mob* from, int32 damage, uint16 spell_id, SkillUseTypes attack_skill, bool avoidable = true, int8 buffslot = -1, bool iBuffTic = false) { return; }
|
||||
virtual bool Attack(Mob* other, int Hand = MainPrimary, bool FromRiposte = false, bool IsStrikethrough = true, bool IsFromSpell = false,
|
||||
ExtraAttackOptions *opts = nullptr) { return false; }
|
||||
virtual bool HasRaid() { return false; }
|
||||
virtual bool HasGroup() { return false; }
|
||||
virtual Raid* GetRaid() { return 0; }
|
||||
virtual Group* GetGroup() { return 0; }
|
||||
virtual bool Death(Mob* killerMob, int32 damage, uint16 spell_id, SkillUseTypes attack_skill) { return true; }
|
||||
virtual void Damage(Mob* from, int32 damage, uint16 spell_id, SkillUseTypes attack_skill, bool avoidable = true, int8 buffslot = -1, bool iBuffTic = false) { return; }
|
||||
virtual bool Attack(Mob* other, int Hand = MainPrimary, bool FromRiposte = false,
|
||||
bool IsStrikethrough = true, bool IsFromSpell = false, ExtraAttackOptions *opts = nullptr) { return false; }
|
||||
virtual bool HasRaid() { return false; }
|
||||
virtual bool HasGroup() { return false; }
|
||||
virtual Raid* GetRaid() { return 0; }
|
||||
virtual Group* GetGroup() { return 0; }
|
||||
|
||||
void LoadPlayerCorpseDecayTime(uint32 dbid);
|
||||
void LoadPlayerCorpseDecayTime(uint32 dbid);
|
||||
|
||||
bool IsCorpse() const { return true; }
|
||||
bool IsPlayerCorpse() const { return p_PlayerCorpse; }
|
||||
bool IsNPCCorpse() const { return !p_PlayerCorpse; }
|
||||
bool IsBecomeNPCCorpse() const { return become_npc; }
|
||||
bool Process();
|
||||
bool Save();
|
||||
uint32 GetCharID() { return charid; }
|
||||
uint32 SetCharID(uint32 iCharID) { if (IsPlayerCorpse()) { return (charid=iCharID); } return 0xFFFFFFFF; };
|
||||
uint32 GetDecayTime() { if (!corpse_decay_timer.Enabled()) return 0xFFFFFFFF; else return corpse_decay_timer.GetRemainingTime(); }
|
||||
uint32 GetResTime() { if (!corpse_res_timer.Enabled()) return 0; else return corpse_res_timer.GetRemainingTime(); }
|
||||
void CalcCorpseName();
|
||||
inline void Lock() { pLocked = true; }
|
||||
inline void UnLock() { pLocked = false; }
|
||||
inline bool IsLocked() { return pLocked; }
|
||||
inline void ResetLooter() { BeingLootedBy = 0xFFFFFFFF; }
|
||||
inline bool IsBeingLooted() { return (BeingLootedBy != 0xFFFFFFFF); }
|
||||
inline uint32 GetDBID() { return dbid; }
|
||||
bool IsCorpse() const { return true; }
|
||||
bool IsPlayerCorpse() const { return is_player_corpse; }
|
||||
bool IsNPCCorpse() const { return !is_player_corpse; }
|
||||
bool IsBecomeNPCCorpse() const { return become_npc; }
|
||||
bool Process();
|
||||
bool Save();
|
||||
uint32 GetCharID() { return char_id; }
|
||||
uint32 SetCharID(uint32 iCharID) { if (IsPlayerCorpse()) { return (char_id = iCharID); } return 0xFFFFFFFF; };
|
||||
uint32 GetDecayTime() { if (!corpse_decay_timer.Enabled()) return 0xFFFFFFFF; else return corpse_decay_timer.GetRemainingTime(); }
|
||||
uint32 GetResTime() { if (!corpse_res_timer.Enabled()) return 0; else return corpse_res_timer.GetRemainingTime(); }
|
||||
void CalcCorpseName();
|
||||
inline void Lock() { is_locked = true; }
|
||||
inline void UnLock() { is_locked = false; }
|
||||
inline bool IsLocked() { return is_locked; }
|
||||
inline void ResetLooter() { being_looted_by = 0xFFFFFFFF; }
|
||||
inline bool IsBeingLooted() { return (being_looted_by != 0xFFFFFFFF); }
|
||||
inline uint32 GetDBID() { return corpse_db_id; }
|
||||
inline char* GetOwnerName() { return orgname;}
|
||||
|
||||
void SetDecayTimer(uint32 decaytime);
|
||||
bool IsEmpty() const;
|
||||
void AddItem(uint32 itemnum, uint16 charges, int16 slot = 0, uint32 aug1=0, uint32 aug2=0, uint32 aug3=0, uint32 aug4=0, uint32 aug5=0);
|
||||
uint32 GetWornItem(int16 equipSlot) const;
|
||||
ServerLootItem_Struct* GetItem(uint16 lootslot, ServerLootItem_Struct** bag_item_data = 0);
|
||||
void RemoveItem(uint16 lootslot);
|
||||
void RemoveItem(ServerLootItem_Struct* item_data);
|
||||
void SetCash(uint32 in_copper, uint32 in_silver, uint32 in_gold, uint32 in_platinum);
|
||||
void RemoveCash();
|
||||
void QueryLoot(Client* to);
|
||||
uint32 CountItems();
|
||||
void Delete();
|
||||
void Bury();
|
||||
virtual void Depop();
|
||||
virtual void DepopCorpse();
|
||||
void SetDecayTimer(uint32 decaytime);
|
||||
bool IsEmpty() const;
|
||||
void AddItem(uint32 itemnum, uint16 charges, int16 slot = 0, uint32 aug1=0, uint32 aug2=0, uint32 aug3=0, uint32 aug4=0, uint32 aug5=0);
|
||||
uint32 GetWornItem(int16 equipSlot) const;
|
||||
ServerLootItem_Struct* GetItem(uint16 lootslot, ServerLootItem_Struct** bag_item_data = 0);
|
||||
void RemoveItem(uint16 lootslot);
|
||||
void RemoveItem(ServerLootItem_Struct* item_data);
|
||||
void SetCash(uint32 in_copper, uint32 in_silver, uint32 in_gold, uint32 in_platinum);
|
||||
void RemoveCash();
|
||||
void QueryLoot(Client* to);
|
||||
uint32 CountItems();
|
||||
void Delete();
|
||||
void Bury();
|
||||
virtual void Depop();
|
||||
virtual void DepopCorpse();
|
||||
|
||||
uint32 GetCopper() { return copper; }
|
||||
uint32 GetSilver() { return silver; }
|
||||
@ -97,19 +97,19 @@ public:
|
||||
bool Summon(Client* client, bool spell, bool CheckDistance);
|
||||
void CastRezz(uint16 spellid, Mob* Caster);
|
||||
void CompleteRezz();
|
||||
void SetPKItem(int32 id) { pkitem = id; }
|
||||
int32 GetPKItem() { return pkitem; }
|
||||
bool CanMobLoot(int charid);
|
||||
void AllowMobLoot(Mob *them, uint8 slot);
|
||||
void AddLooter(Mob *who);
|
||||
bool Rezzed() { return rez; }
|
||||
void Rezzed(bool in_rez) { rez = in_rez; }
|
||||
void SetPKItem(int32 id) { player_kill_item = id; }
|
||||
int32 GetPKItem() { return player_kill_item; }
|
||||
bool CanMobLoot(int charid);
|
||||
void AllowMobLoot(Mob *them, uint8 slot);
|
||||
void AddLooter(Mob *who);
|
||||
bool IsRezzed() { return rez; }
|
||||
void IsRezzed(bool in_rez) { rez = in_rez; }
|
||||
void Spawn();
|
||||
|
||||
char orgname[64];
|
||||
uint32 GetEquipment(uint8 material_slot) const; // returns item id
|
||||
uint32 GetEquipmentColor(uint8 material_slot) const;
|
||||
inline int GetRezzExp() { return rezzexp; }
|
||||
uint32 GetEquipment(uint8 material_slot) const; // returns item id
|
||||
uint32 GetEquipmentColor(uint8 material_slot) const;
|
||||
inline int GetRezzExp() { return rezzexp; }
|
||||
|
||||
// these are a temporary work-around until corpse inventory is removed from the database blob
|
||||
static int16 ServerToCorpseSlot(int16 server_slot); // encode
|
||||
@ -119,24 +119,25 @@ protected:
|
||||
std::list<uint32> MoveItemToCorpse(Client *client, ItemInst *item, int16 equipslot);
|
||||
|
||||
private:
|
||||
bool p_PlayerCorpse; bool pIsChanged;
|
||||
bool pLocked;
|
||||
int32 pkitem;
|
||||
uint32 dbid;
|
||||
uint32 charid;
|
||||
bool is_player_corpse;
|
||||
bool is_corpse_changed;
|
||||
bool is_locked;
|
||||
int32 player_kill_item;
|
||||
uint32 corpse_db_id;
|
||||
uint32 char_id;
|
||||
ItemList itemlist;
|
||||
uint32 copper;
|
||||
uint32 silver;
|
||||
uint32 gold;
|
||||
uint32 platinum;
|
||||
bool p_depop;
|
||||
uint32 BeingLootedBy;
|
||||
bool player_corpse_depop;
|
||||
uint32 being_looted_by;
|
||||
uint32 rezzexp;
|
||||
bool rez;
|
||||
bool can_rez;
|
||||
bool become_npc;
|
||||
int looters[MAX_LOOTERS]; // People allowed to loot the corpse, character id
|
||||
Timer corpse_decay_timer;
|
||||
int allowed_looters[MAX_LOOTERS]; // People allowed to loot the corpse, character id
|
||||
Timer corpse_decay_timer;
|
||||
Timer corpse_res_timer;
|
||||
Timer corpse_delay_timer;
|
||||
Timer corpse_graveyard_timer;
|
||||
|
||||
@ -50,7 +50,7 @@ Doors::Doors(const Door* door)
|
||||
incline = door->incline;
|
||||
opentype = door->opentype;
|
||||
guild_id = door->guild_id;
|
||||
lockpick = door->lockpick;
|
||||
lockpick = door->lock_pick;
|
||||
keyitem = door->keyitem;
|
||||
nokeyring = door->nokeyring;
|
||||
trigger_door = door->trigger_door;
|
||||
@ -678,7 +678,7 @@ bool ZoneDatabase::LoadDoors(int32 iDoorCount, Door *into, const char *zone_name
|
||||
into[rowIndex].heading = (float)atof(row[7]);
|
||||
into[rowIndex].opentype = atoi(row[8]);
|
||||
into[rowIndex].guild_id = atoi(row[9]);
|
||||
into[rowIndex].lockpick = atoi(row[10]);
|
||||
into[rowIndex].lock_pick = atoi(row[10]);
|
||||
into[rowIndex].keyitem = atoi(row[11]);
|
||||
into[rowIndex].nokeyring = atoi(row[12]);
|
||||
into[rowIndex].trigger_door = atoi(row[13]);
|
||||
|
||||
@ -1678,7 +1678,7 @@ int EntityList::RezzAllCorpsesByCharID(uint32 charid)
|
||||
while (it != corpse_list.end()) {
|
||||
if (it->second->GetCharID() == charid) {
|
||||
RezzExp += it->second->GetRezzExp();
|
||||
it->second->Rezzed(true);
|
||||
it->second->IsRezzed(true);
|
||||
it->second->CompleteRezz();
|
||||
}
|
||||
++it;
|
||||
|
||||
@ -858,7 +858,7 @@ void Client::PutLootInInventory(int16 slot_id, const ItemInst &inst, ServerLootI
|
||||
{
|
||||
if(bag_item_data[i] == nullptr)
|
||||
continue;
|
||||
const ItemInst *bagitem = database.CreateItem(bag_item_data[i]->item_id, bag_item_data[i]->charges, bag_item_data[i]->aug1, bag_item_data[i]->aug2, bag_item_data[i]->aug3, bag_item_data[i]->aug4, bag_item_data[i]->aug5);
|
||||
const ItemInst *bagitem = database.CreateItem(bag_item_data[i]->item_id, bag_item_data[i]->charges, bag_item_data[i]->aug_1, bag_item_data[i]->aug_2, bag_item_data[i]->aug_3, bag_item_data[i]->aug_4, bag_item_data[i]->aug_5);
|
||||
interior_slot = Inventory::CalcSlotId(slot_id, i);
|
||||
mlog(INVENTORY__SLOTS, "Putting bag loot item %s (%d) into slot %d (bag slot %d)", inst.GetItem()->Name, inst.GetItem()->ID, interior_slot, i);
|
||||
PutLootInInventory(interior_slot, *bagitem);
|
||||
|
||||
@ -195,13 +195,13 @@ void NPC::AddLootDrop(const Item_Struct *item2, ItemList* itemlist, int16 charge
|
||||
|
||||
item->item_id = item2->ID;
|
||||
item->charges = charges;
|
||||
item->aug1 = 0;
|
||||
item->aug2 = 0;
|
||||
item->aug3 = 0;
|
||||
item->aug4 = 0;
|
||||
item->aug5 = 0;
|
||||
item->minlevel = minlevel;
|
||||
item->maxlevel = maxlevel;
|
||||
item->aug_1 = 0;
|
||||
item->aug_2 = 0;
|
||||
item->aug_3 = 0;
|
||||
item->aug_4 = 0;
|
||||
item->aug_5 = 0;
|
||||
item->min_level = minlevel;
|
||||
item->max_level = maxlevel;
|
||||
if (equipit) {
|
||||
uint8 eslot = 0xFF;
|
||||
char newid[20];
|
||||
@ -339,7 +339,7 @@ void NPC::AddLootDrop(const Item_Struct *item2, ItemList* itemlist, int16 charge
|
||||
if (found) {
|
||||
CalcBonuses(); // This is less than ideal for bulk adding of items
|
||||
}
|
||||
item->equipSlot = item2->Slots;
|
||||
item->equip_slot = item2->Slots;
|
||||
}
|
||||
|
||||
if(itemlist != nullptr)
|
||||
|
||||
@ -44,7 +44,7 @@ uint32 Lua_Corpse::GetDBID() {
|
||||
|
||||
bool Lua_Corpse::IsRezzed() {
|
||||
Lua_Safe_Call_Bool();
|
||||
return self->Rezzed();
|
||||
return self->IsRezzed();
|
||||
}
|
||||
|
||||
const char* Lua_Corpse::GetOwnerName() {
|
||||
|
||||
@ -4338,7 +4338,7 @@ Corpse* Merc::GetGroupMemberCorpse() {
|
||||
if(g->members[i] && g->members[i]->IsClient()) {
|
||||
corpse = entity_list.GetCorpseByOwnerWithinRange(g->members[i]->CastToClient(), this, RuleI(Mercs, ResurrectRadius));
|
||||
|
||||
if(corpse && !corpse->Rezzed()) {
|
||||
if(corpse && !corpse->IsRezzed()) {
|
||||
return corpse;
|
||||
}
|
||||
}
|
||||
@ -6367,4 +6367,4 @@ uint32 Merc::CalcUpkeepCost(uint32 templateID , uint8 level, uint8 currency_type
|
||||
}
|
||||
|
||||
return cost;
|
||||
}
|
||||
}
|
||||
|
||||
14
zone/npc.cpp
14
zone/npc.cpp
@ -429,7 +429,7 @@ ServerLootItem_Struct* NPC::GetItem(int slot_id) {
|
||||
end = itemlist.end();
|
||||
for(; cur != end; ++cur) {
|
||||
ServerLootItem_Struct* item = *cur;
|
||||
if (item->equipSlot == slot_id) {
|
||||
if (item->equip_slot == slot_id) {
|
||||
return item;
|
||||
}
|
||||
}
|
||||
@ -446,7 +446,7 @@ void NPC::RemoveItem(uint32 item_id, uint16 quantity, uint16 slot) {
|
||||
itemlist.erase(cur);
|
||||
return;
|
||||
}
|
||||
else if (item->item_id == item_id && item->equipSlot == slot && quantity >= 1) {
|
||||
else if (item->item_id == item_id && item->equip_slot == slot && quantity >= 1) {
|
||||
//std::cout<<"NPC::RemoveItem"<<" equipSlot:"<<iterator.GetData()->equipSlot<<" quantity:"<< quantity<<std::endl; // iterator undefined [CODEBUG]
|
||||
if (item->charges <= quantity)
|
||||
itemlist.erase(cur);
|
||||
@ -471,9 +471,9 @@ void NPC::CheckMinMaxLevel(Mob *them)
|
||||
if(!(*cur))
|
||||
return;
|
||||
|
||||
if(themlevel < (*cur)->minlevel || themlevel > (*cur)->maxlevel)
|
||||
if(themlevel < (*cur)->min_level || themlevel > (*cur)->max_level)
|
||||
{
|
||||
material = Inventory::CalcMaterialFromSlot((*cur)->equipSlot);
|
||||
material = Inventory::CalcMaterialFromSlot((*cur)->equip_slot);
|
||||
if(material != 0xFF)
|
||||
SendWearChange(material);
|
||||
|
||||
@ -508,15 +508,15 @@ void NPC::QueryLoot(Client* to) {
|
||||
if (item)
|
||||
if (to->GetClientVersion() >= EQClientRoF)
|
||||
{
|
||||
to->Message(0, "minlvl: %i maxlvl: %i %i: %c%06X0000000000000000000000000000000000000000000000000%s%c",(*cur)->minlevel, (*cur)->maxlevel, (int) item->ID,0x12, item->ID, item->Name, 0x12);
|
||||
to->Message(0, "minlvl: %i maxlvl: %i %i: %c%06X0000000000000000000000000000000000000000000000000%s%c",(*cur)->min_level, (*cur)->max_level, (int) item->ID,0x12, item->ID, item->Name, 0x12);
|
||||
}
|
||||
else if (to->GetClientVersion() >= EQClientSoF)
|
||||
{
|
||||
to->Message(0, "minlvl: %i maxlvl: %i %i: %c%06X00000000000000000000000000000000000000000000%s%c",(*cur)->minlevel, (*cur)->maxlevel, (int) item->ID,0x12, item->ID, item->Name, 0x12);
|
||||
to->Message(0, "minlvl: %i maxlvl: %i %i: %c%06X00000000000000000000000000000000000000000000%s%c",(*cur)->min_level, (*cur)->max_level, (int) item->ID,0x12, item->ID, item->Name, 0x12);
|
||||
}
|
||||
else
|
||||
{
|
||||
to->Message(0, "minlvl: %i maxlvl: %i %i: %c%06X000000000000000000000000000000000000000%s%c",(*cur)->minlevel, (*cur)->maxlevel, (int) item->ID,0x12, item->ID, item->Name, 0x12);
|
||||
to->Message(0, "minlvl: %i maxlvl: %i %i: %c%06X000000000000000000000000000000000000000%s%c",(*cur)->min_level, (*cur)->max_level, (int) item->ID,0x12, item->ID, item->Name, 0x12);
|
||||
}
|
||||
else
|
||||
LogFile->write(EQEMuLog::Error, "Database error, invalid item");
|
||||
|
||||
@ -780,7 +780,7 @@ XS(XS_Corpse_IsRezzed)
|
||||
if(THIS == nullptr)
|
||||
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
|
||||
|
||||
RETVAL = THIS->Rezzed();
|
||||
RETVAL = THIS->IsRezzed();
|
||||
ST(0) = boolSV(RETVAL);
|
||||
sv_2mortal(ST(0));
|
||||
}
|
||||
|
||||
@ -1744,7 +1744,7 @@ bool QuestManager::summonburriedplayercorpse(uint32 char_id, float dest_x, float
|
||||
bool Result = false;
|
||||
|
||||
if(char_id > 0) {
|
||||
Corpse* PlayerCorpse = database.SummonBurriedPlayerCorpse(char_id, zone->GetZoneID(), zone->GetInstanceID(), dest_x, dest_y, dest_z, dest_heading);
|
||||
Corpse* PlayerCorpse = database.SummonBuriedCharacterCorpses(char_id, zone->GetZoneID(), zone->GetInstanceID(), dest_x, dest_y, dest_z, dest_heading);
|
||||
if(PlayerCorpse) {
|
||||
Result = true;
|
||||
}
|
||||
@ -1767,7 +1767,7 @@ uint32 QuestManager::getplayerburriedcorpsecount(uint32 char_id) {
|
||||
uint32 Result = 0;
|
||||
|
||||
if(char_id > 0) {
|
||||
Result = database.GetPlayerBurriedCorpseCount(char_id);
|
||||
Result = database.GetCharacterBuriedCorpseCount(char_id);
|
||||
}
|
||||
return Result;
|
||||
}
|
||||
@ -1781,7 +1781,7 @@ bool QuestManager::buryplayercorpse(uint32 char_id)
|
||||
uint32 PlayerCorpse = database.GetFirstCorpseID(char_id);
|
||||
if(PlayerCorpse > 0)
|
||||
{
|
||||
database.BuryPlayerCorpse(PlayerCorpse);
|
||||
database.BuryCharacterCorpse(PlayerCorpse);
|
||||
Corpse* corpse = entity_list.GetCorpseByDBID(PlayerCorpse);
|
||||
if(corpse)
|
||||
{
|
||||
|
||||
@ -736,8 +736,6 @@ bool SpawnConditionManager::LoadSpawnConditions(const char* zone_name, uint32 in
|
||||
//clear out old stuff..
|
||||
spawn_conditions.clear();
|
||||
|
||||
|
||||
|
||||
std::string query = StringFormat("SELECT id, onchange, value "
|
||||
"FROM spawn_conditions "
|
||||
"WHERE zone = '%s'", zone_name);
|
||||
|
||||
@ -3806,9 +3806,9 @@ bool Mob::SpellOnTarget(uint16 spell_id, Mob* spelltar, bool reflect, bool use_r
|
||||
|
||||
void Corpse::CastRezz(uint16 spellid, Mob* Caster)
|
||||
{
|
||||
_log(SPELLS__REZ, "Corpse::CastRezz spellid %i, Rezzed() is %i, rezzexp is %i", spellid,Rezzed(),rezzexp);
|
||||
_log(SPELLS__REZ, "Corpse::CastRezz spellid %i, Rezzed() is %i, rezzexp is %i", spellid,IsRezzed(),rezzexp);
|
||||
|
||||
if(Rezzed()){
|
||||
if(IsRezzed()){
|
||||
if(Caster && Caster->IsClient())
|
||||
Caster->Message(13,"This character has already been resurrected.");
|
||||
|
||||
@ -3838,7 +3838,7 @@ void Corpse::CastRezz(uint16 spellid, Mob* Caster)
|
||||
rezz->unknown020 = 0x00000000;
|
||||
rezz->unknown088 = 0x00000000;
|
||||
// We send this to world, because it needs to go to the player who may not be in this zone.
|
||||
worldserver.RezzPlayer(outapp, rezzexp, dbid, OP_RezzRequest);
|
||||
worldserver.RezzPlayer(outapp, rezzexp, corpse_db_id, OP_RezzRequest);
|
||||
_pkt(SPELLS__REZ, outapp);
|
||||
safe_delete(outapp);
|
||||
}
|
||||
|
||||
@ -704,7 +704,7 @@ void WorldServer::Process() {
|
||||
|
||||
_log(SPELLS__REZ, "Found corpse. Marking corpse as rezzed.");
|
||||
// I don't know why Rezzed is not set to true in CompleteRezz().
|
||||
corpse->Rezzed(true);
|
||||
corpse->IsRezzed(true);
|
||||
corpse->CompleteRezz();
|
||||
}
|
||||
}
|
||||
@ -1382,7 +1382,7 @@ void WorldServer::Process() {
|
||||
|
||||
case ServerOP_SpawnPlayerCorpse: {
|
||||
SpawnPlayerCorpse_Struct* s = (SpawnPlayerCorpse_Struct*)pack->pBuffer;
|
||||
Corpse* NewCorpse = database.LoadPlayerCorpse(s->player_corpse_id);
|
||||
Corpse* NewCorpse = database.LoadCharacterCorpse(s->player_corpse_id);
|
||||
if(NewCorpse)
|
||||
NewCorpse->Spawn();
|
||||
else
|
||||
|
||||
@ -917,7 +917,7 @@ bool Zone::Init(bool iStaticZone) {
|
||||
}
|
||||
|
||||
LogFile->write(EQEMuLog::Status, "Loading player corpses...");
|
||||
if (!database.LoadPlayerCorpses(zoneid, instanceid)) {
|
||||
if (!database.LoadCharacterCorpses(zoneid, instanceid)) {
|
||||
LogFile->write(EQEMuLog::Error, "Loading player corpses failed.");
|
||||
return false;
|
||||
}
|
||||
|
||||
675
zone/zonedb.cpp
675
zone/zonedb.cpp
@ -7,6 +7,7 @@
|
||||
#include "../common/rulesys.h"
|
||||
#include "../common/rdtsc.h"
|
||||
#include "zone.h"
|
||||
#include "corpse.h"
|
||||
#include "client.h"
|
||||
#include "merc.h"
|
||||
#include "groups.h"
|
||||
@ -1236,7 +1237,6 @@ bool ZoneDatabase::SaveCharacterBindPoint(uint32 character_id, uint32 zone_id, u
|
||||
if (!results.RowsAffected()) {
|
||||
LogFile->write(EQEMuLog::Debug, "ERROR Bind Home Save: %s. %s", results.ErrorMessage().c_str(), query.c_str());
|
||||
}
|
||||
ThrowDBError(results.ErrorMessage(), "ZoneDatabase::SaveCharacterBindPoint", query);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -1247,14 +1247,12 @@ bool ZoneDatabase::SaveCharacterMaterialColor(uint32 character_id, uint32 slot_i
|
||||
|
||||
std::string query = StringFormat("REPLACE INTO `character_material` (id, slot, red, green, blue, color, use_tint) VALUES (%u, %u, %u, %u, %u, %u, 255)", character_id, slot_id, red, green, blue, color); auto results = QueryDatabase(query);
|
||||
LogFile->write(EQEMuLog::Debug, "ZoneDatabase::SaveCharacterMaterialColor for character ID: %i, slot_id: %u color: %u done", character_id, slot_id, color);
|
||||
ThrowDBError(results.ErrorMessage(), "ZoneDatabase::SaveCharacterMaterialColor", query);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ZoneDatabase::SaveCharacterSkill(uint32 character_id, uint32 skill_id, uint32 value){
|
||||
std::string query = StringFormat("REPLACE INTO `character_skills` (id, skill_id, value) VALUES (%u, %u, %u)", character_id, skill_id, value); auto results = QueryDatabase(query);
|
||||
LogFile->write(EQEMuLog::Debug, "ZoneDatabase::SaveCharacterSkill for character ID: %i, skill_id:%u value:%u done", character_id, skill_id, value);
|
||||
ThrowDBError(results.ErrorMessage(), "ZoneDatabase::SaveCharacterSkill", query);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -1262,7 +1260,6 @@ bool ZoneDatabase::SaveCharacterDisc(uint32 character_id, uint32 slot_id, uint32
|
||||
std::string query = StringFormat("REPLACE INTO `character_disciplines` (id, slot_id, disc_id) VALUES (%u, %u, %u)", character_id, slot_id, disc_id);
|
||||
auto results = QueryDatabase(query);
|
||||
LogFile->write(EQEMuLog::Debug, "ZoneDatabase::SaveCharacterDisc for character ID: %i, slot:%u disc_id:%u done", character_id, slot_id, disc_id);
|
||||
ThrowDBError(results.ErrorMessage(), "ZoneDatabase::SaveCharacterDisc", query);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -1285,7 +1282,6 @@ bool ZoneDatabase::SaveCharacterBandolier(uint32 character_id, uint8 bandolier_i
|
||||
DoEscapeString(bandolier_name_esc, bandolier_name, strlen(bandolier_name));
|
||||
std::string query = StringFormat("REPLACE INTO `character_bandolier` (id, bandolier_id, bandolier_slot, item_id, icon, bandolier_name) VALUES (%u, %u, %u, %u, %u,'%s')", character_id, bandolier_id, bandolier_slot, item_id, icon, bandolier_name_esc);
|
||||
auto results = QueryDatabase(query);
|
||||
ThrowDBError(results.ErrorMessage(), "ZoneDatabase::SaveCharacterBandolier", query);
|
||||
LogFile->write(EQEMuLog::Debug, "ZoneDatabase::SaveCharacterBandolier for character ID: %i, bandolier_id: %u, bandolier_slot: %u item_id: %u, icon:%u band_name:%s done", character_id, bandolier_id, bandolier_slot, item_id, icon, bandolier_name);
|
||||
if (!results.RowsAffected()){ std::cout << "ERROR Bandolier Save: " << results.ErrorMessage() << "\n\n" << query << "\n" << std::endl; }
|
||||
return true;
|
||||
@ -1294,7 +1290,6 @@ bool ZoneDatabase::SaveCharacterBandolier(uint32 character_id, uint8 bandolier_i
|
||||
bool ZoneDatabase::SaveCharacterPotionBelt(uint32 character_id, uint8 potion_id, uint32 item_id, uint32 icon) {
|
||||
std::string query = StringFormat("REPLACE INTO `character_potionbelt` (id, potion_id, item_id, icon) VALUES (%u, %u, %u, %u)", character_id, potion_id, item_id, icon);
|
||||
auto results = QueryDatabase(query);
|
||||
ThrowDBError(results.ErrorMessage(), "ZoneDatabase::SaveCharacterPotionBelt", query);
|
||||
if (!results.RowsAffected()){ std::cout << "ERROR Potionbelt Save: " << results.ErrorMessage() << "\n\n" << query << "\n" << std::endl; }
|
||||
return true;
|
||||
}
|
||||
@ -1311,7 +1306,6 @@ bool ZoneDatabase::SaveCharacterLeadershipAA(uint32 character_id, PlayerProfile_
|
||||
}
|
||||
}
|
||||
auto results = QueryDatabase(query);
|
||||
ThrowDBError(results.ErrorMessage(), "ZoneDatabase::SaveCharacterLeadershipAA", query);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -1603,7 +1597,6 @@ bool ZoneDatabase::SaveCharacterData(uint32 character_id, uint32 account_id, Pla
|
||||
m_epp->expended_aa
|
||||
);
|
||||
auto results = database.QueryDatabase(query);
|
||||
ThrowDBError(results.ErrorMessage(), "ZoneDatabase:SaveCharacterData", query);
|
||||
LogFile->write(EQEMuLog::Debug, "ZoneDatabase::SaveCharacterData %i, done... Took %f seconds", character_id, ((float)(std::clock() - t)) / CLOCKS_PER_SEC);
|
||||
return true;
|
||||
}
|
||||
@ -1645,7 +1638,6 @@ bool ZoneDatabase::SaveCharacterCurrency(uint32 character_id, PlayerProfile_Stru
|
||||
pp->currentEbonCrystals,
|
||||
pp->careerEbonCrystals);
|
||||
auto results = database.QueryDatabase(query);
|
||||
ThrowDBError(results.ErrorMessage(), "ZoneDatabase::SaveCharacterCurrency", query);
|
||||
LogFile->write(EQEMuLog::Debug, "Saving Currency for character ID: %i, done", character_id);
|
||||
return true;
|
||||
}
|
||||
@ -1655,7 +1647,6 @@ bool ZoneDatabase::SaveCharacterAA(uint32 character_id, uint32 aa_id, uint32 cur
|
||||
" VALUES (%u, %u, %u)",
|
||||
character_id, aa_id, current_level);
|
||||
auto results = QueryDatabase(rquery);
|
||||
ThrowDBError(results.ErrorMessage(), "ZoneDatabase::SaveCharacterAA", rquery);
|
||||
LogFile->write(EQEMuLog::Debug, "Saving AA for character ID: %u, aa_id: %u current_level: %u", character_id, aa_id, current_level);
|
||||
return true;
|
||||
}
|
||||
@ -3328,3 +3319,667 @@ bool ZoneDatabase::GetFactionIdsForNPC(uint32 nfl_id, std::list<struct NPCFactio
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/* Corpse Queries */
|
||||
|
||||
bool ZoneDatabase::DeleteGraveyard(uint32 zone_id, uint32 graveyard_id) {
|
||||
std::string query = StringFormat( "UPDATE `zone` SET `graveyard_id` = 0 WHERE `zone_idnumber` = %u AND `version` = 0", zone_id);
|
||||
auto results = QueryDatabase(query);
|
||||
|
||||
query = StringFormat("DELETE FROM `graveyard` WHERE `id` = %u", graveyard_id);
|
||||
auto results2 = QueryDatabase(query);
|
||||
|
||||
if (results.Success() && results2.Success()){
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
uint32 ZoneDatabase::AddGraveyardIDToZone(uint32 zone_id, uint32 graveyard_id) {
|
||||
std::string query = StringFormat(
|
||||
"UPDATE `zone` SET `graveyard_id` = %u WHERE `zone_idnumber` = %u AND `version` = 0",
|
||||
graveyard_id, zone_id
|
||||
);
|
||||
auto results = QueryDatabase(query);
|
||||
return zone_id;
|
||||
}
|
||||
|
||||
uint32 ZoneDatabase::CreateGraveyardRecord(uint32 graveyard_zone_id, float graveyard_x, float graveyard_y, float graveyard_z, float graveyard_heading) {
|
||||
std::string query = StringFormat(
|
||||
"INSERT INTO `graveyard` SET `zone_id` = %u, `x` = %1.1f, `y` = %1.1f, `z` = %1.1f, `heading` = %1.1f",
|
||||
graveyard_zone_id, graveyard_x, graveyard_y, graveyard_z, graveyard_heading
|
||||
);
|
||||
auto results = QueryDatabase(query);
|
||||
if (results.Success()){
|
||||
return results.LastInsertedID();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
uint32 ZoneDatabase::SendCharacterCorpseToGraveyard(uint32 dbid, uint32 zone_id, uint16 instance_id, float x, float y, float z, float heading) {
|
||||
std::string query = StringFormat(
|
||||
"UPDATE `character_corpses` "
|
||||
"SET `zone_id` = %u, `instance_id` = 0, `x` = %1.1f, `y` = %1.1f, `z` = %1.1f, `heading` = %1.1f, `was_at_graveyard` = 1 "
|
||||
"WHERE `id` = %d",
|
||||
zone_id, x, y, z, heading, dbid
|
||||
);
|
||||
QueryDatabase(query);
|
||||
return dbid;
|
||||
}
|
||||
|
||||
uint32 ZoneDatabase::GetCharacterCorpseDecayTimer(uint32 corpse_db_id){
|
||||
std::string query = StringFormat("SELECT(UNIX_TIMESTAMP() - UNIX_TIMESTAMP(time_of_death)) FROM `character_corpses` WHERE `id` = %d AND NOT `time_of_death` = 0", corpse_db_id);
|
||||
auto results = QueryDatabase(query);
|
||||
auto row = results.begin();
|
||||
if (results.Success() && results.RowsAffected() != 0){
|
||||
return atoll(row[0]);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint32 ZoneDatabase::UpdateCharacterCorpse(uint32 db_id, uint32 char_id, const char* char_name, uint32 zone_id, uint16 instance_id, PlayerCorpse_Struct* dbpc, float x, float y, float z, float heading, bool is_rezzed) {
|
||||
std::string query = StringFormat("UPDATE `character_corpses` SET \n"
|
||||
"`charname` = '%s',\n"
|
||||
"`zone_id` = %u,\n"
|
||||
"`instance_id` = %u,\n"
|
||||
"`charid` = %d,\n"
|
||||
"`x` = %1.1f,\n"
|
||||
"`y` = %1.1f,\n"
|
||||
"`z` = %1.1f,\n"
|
||||
"`heading` = %1.1f,\n"
|
||||
"`is_locked` = %d,\n"
|
||||
"`exp` = %u,\n"
|
||||
"`size` = %f,\n"
|
||||
"`level` = %u,\n"
|
||||
"`race` = %u,\n"
|
||||
"`gender` = %u,\n"
|
||||
"`class` = %u,\n"
|
||||
"`deity` = %u,\n"
|
||||
"`texture` = %u,\n"
|
||||
"`helm_texture` = %u,\n"
|
||||
"`copper` = %u,\n"
|
||||
"`silver` = %u,\n"
|
||||
"`gold` = %u,\n"
|
||||
"`platinum` = %u,\n"
|
||||
"`hair_color` = %u,\n"
|
||||
"`beard_color` = %u,\n"
|
||||
"`eye_color_1` = %u,\n"
|
||||
"`eye_color_2` = %u,\n"
|
||||
"`hair_style` = %u,\n"
|
||||
"`face` = %u,\n"
|
||||
"`beard` = %u,\n"
|
||||
"`drakkin_heritage` = %u,\n"
|
||||
"`drakkin_tattoo` = %u,\n"
|
||||
"`drakkin_details` = %u,\n"
|
||||
"`wc_1` = %u,\n"
|
||||
"`wc_2` = %u,\n"
|
||||
"`wc_3` = %u,\n"
|
||||
"`wc_4` = %u,\n"
|
||||
"`wc_5` = %u,\n"
|
||||
"`wc_6` = %u,\n"
|
||||
"`wc_7` = %u,\n"
|
||||
"`wc_8` = %u,\n"
|
||||
"`wc_9` = %u \n"
|
||||
"WHERE `id` = %u",
|
||||
EscapeString(char_name).c_str(),
|
||||
zone_id,
|
||||
instance_id,
|
||||
char_id,
|
||||
x,
|
||||
y,
|
||||
z,
|
||||
heading,
|
||||
dbpc->locked,
|
||||
dbpc->exp,
|
||||
dbpc->size,
|
||||
dbpc->level,
|
||||
dbpc->race,
|
||||
dbpc->gender,
|
||||
dbpc->class_,
|
||||
dbpc->deity,
|
||||
dbpc->texture,
|
||||
dbpc->helmtexture,
|
||||
dbpc->copper,
|
||||
dbpc->silver,
|
||||
dbpc->gold,
|
||||
dbpc->plat,
|
||||
dbpc->haircolor,
|
||||
dbpc->beardcolor,
|
||||
dbpc->eyecolor1,
|
||||
dbpc->eyecolor2,
|
||||
dbpc->hairstyle,
|
||||
dbpc->face,
|
||||
dbpc->beard,
|
||||
dbpc->drakkin_heritage,
|
||||
dbpc->drakkin_tattoo,
|
||||
dbpc->drakkin_details,
|
||||
dbpc->item_tint[0].color,
|
||||
dbpc->item_tint[1].color,
|
||||
dbpc->item_tint[2].color,
|
||||
dbpc->item_tint[3].color,
|
||||
dbpc->item_tint[4].color,
|
||||
dbpc->item_tint[5].color,
|
||||
dbpc->item_tint[6].color,
|
||||
dbpc->item_tint[7].color,
|
||||
dbpc->item_tint[8].color,
|
||||
db_id
|
||||
);
|
||||
auto results = QueryDatabase(query);
|
||||
|
||||
return db_id;
|
||||
}
|
||||
|
||||
void ZoneDatabase::MarkCorpseAsRezzed(uint32 db_id) {
|
||||
std::string query = StringFormat("UPDATE `character_corpses` SET `is_rezzed` = 1 WHERE `id` = %i", db_id);
|
||||
auto results = QueryDatabase(query);
|
||||
}
|
||||
|
||||
uint32 ZoneDatabase::SaveCharacterCorpse(uint32 charid, const char* charname, uint32 zoneid, uint16 instanceid, PlayerCorpse_Struct* dbpc, float x, float y, float z, float heading) {
|
||||
/* Dump Basic Corpse Data */
|
||||
std::string query = StringFormat("INSERT INTO `character_corpses` SET \n"
|
||||
"`charname` = '%s',\n"
|
||||
"`zone_id` = %u,\n"
|
||||
"`instance_id` = %u,\n"
|
||||
"`charid` = %d,\n"
|
||||
"`x` = %1.1f,\n"
|
||||
"`y` = %1.1f,\n"
|
||||
"`z` = %1.1f,\n"
|
||||
"`heading` = %1.1f,\n"
|
||||
"`time_of_death` = NOW(),\n"
|
||||
"`is_buried` = 0,"
|
||||
"`is_locked` = %d,\n"
|
||||
"`exp` = %u,\n"
|
||||
"`size` = %f,\n"
|
||||
"`level` = %u,\n"
|
||||
"`race` = %u,\n"
|
||||
"`gender` = %u,\n"
|
||||
"`class` = %u,\n"
|
||||
"`deity` = %u,\n"
|
||||
"`texture` = %u,\n"
|
||||
"`helm_texture` = %u,\n"
|
||||
"`copper` = %u,\n"
|
||||
"`silver` = %u,\n"
|
||||
"`gold` = %u,\n"
|
||||
"`platinum` = %u,\n"
|
||||
"`hair_color` = %u,\n"
|
||||
"`beard_color` = %u,\n"
|
||||
"`eye_color_1` = %u,\n"
|
||||
"`eye_color_2` = %u,\n"
|
||||
"`hair_style` = %u,\n"
|
||||
"`face` = %u,\n"
|
||||
"`beard` = %u,\n"
|
||||
"`drakkin_heritage` = %u,\n"
|
||||
"`drakkin_tattoo` = %u,\n"
|
||||
"`drakkin_details` = %u,\n"
|
||||
"`wc_1` = %u,\n"
|
||||
"`wc_2` = %u,\n"
|
||||
"`wc_3` = %u,\n"
|
||||
"`wc_4` = %u,\n"
|
||||
"`wc_5` = %u,\n"
|
||||
"`wc_6` = %u,\n"
|
||||
"`wc_7` = %u,\n"
|
||||
"`wc_8` = %u,\n"
|
||||
"`wc_9` = %u \n",
|
||||
EscapeString(charname).c_str(),
|
||||
zoneid,
|
||||
instanceid,
|
||||
charid,
|
||||
x,
|
||||
y,
|
||||
z,
|
||||
heading,
|
||||
dbpc->locked,
|
||||
dbpc->exp,
|
||||
dbpc->size,
|
||||
dbpc->level,
|
||||
dbpc->race,
|
||||
dbpc->gender,
|
||||
dbpc->class_,
|
||||
dbpc->deity,
|
||||
dbpc->texture,
|
||||
dbpc->helmtexture,
|
||||
dbpc->copper,
|
||||
dbpc->silver,
|
||||
dbpc->gold,
|
||||
dbpc->plat,
|
||||
dbpc->haircolor,
|
||||
dbpc->beardcolor,
|
||||
dbpc->eyecolor1,
|
||||
dbpc->eyecolor2,
|
||||
dbpc->hairstyle,
|
||||
dbpc->face,
|
||||
dbpc->beard,
|
||||
dbpc->drakkin_heritage,
|
||||
dbpc->drakkin_tattoo,
|
||||
dbpc->drakkin_details,
|
||||
dbpc->item_tint[0].color,
|
||||
dbpc->item_tint[1].color,
|
||||
dbpc->item_tint[2].color,
|
||||
dbpc->item_tint[3].color,
|
||||
dbpc->item_tint[4].color,
|
||||
dbpc->item_tint[5].color,
|
||||
dbpc->item_tint[6].color,
|
||||
dbpc->item_tint[7].color,
|
||||
dbpc->item_tint[8].color
|
||||
);
|
||||
auto results = QueryDatabase(query);
|
||||
uint32 last_insert_id = results.LastInsertedID();
|
||||
|
||||
/* Dump Items from Inventory */
|
||||
uint8 first_entry = 0;
|
||||
for (unsigned int i = 0; i < dbpc->itemcount; i++) {
|
||||
if (first_entry != 1){
|
||||
query = StringFormat("REPLACE INTO `character_corpse_items` \n"
|
||||
" (corpse_id, equip_slot, item_id, charges, aug_1, aug_2, aug_3, aug_4, aug_5, attuned) \n"
|
||||
" VALUES (%u, %u, %u, %u, %u, %u, %u, %u, %u, 0) \n",
|
||||
last_insert_id,
|
||||
dbpc->items[i].equip_slot,
|
||||
dbpc->items[i].item_id,
|
||||
dbpc->items[i].charges,
|
||||
dbpc->items[i].aug_1,
|
||||
dbpc->items[i].aug_2,
|
||||
dbpc->items[i].aug_3,
|
||||
dbpc->items[i].aug_4,
|
||||
dbpc->items[i].aug_5
|
||||
);
|
||||
first_entry = 1;
|
||||
}
|
||||
else{
|
||||
query = query + StringFormat(", (%u, %u, %u, %u, %u, %u, %u, %u, %u, 0) \n",
|
||||
last_insert_id,
|
||||
dbpc->items[i].equip_slot,
|
||||
dbpc->items[i].item_id,
|
||||
dbpc->items[i].charges,
|
||||
dbpc->items[i].aug_1,
|
||||
dbpc->items[i].aug_2,
|
||||
dbpc->items[i].aug_3,
|
||||
dbpc->items[i].aug_4,
|
||||
dbpc->items[i].aug_5
|
||||
);
|
||||
}
|
||||
}
|
||||
auto sc_results = QueryDatabase(query);
|
||||
return last_insert_id;
|
||||
}
|
||||
|
||||
uint32 ZoneDatabase::GetCharacterBuriedCorpseCount(uint32 char_id) {
|
||||
std::string query = StringFormat("SELECT COUNT(*) FROM `character_corpses` WHERE `charid` = '%u' AND `is_buried` = 1", char_id);
|
||||
auto results = QueryDatabase(query);
|
||||
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
return atoi(row[0]);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint32 ZoneDatabase::GetCharacterCorpseCount(uint32 char_id) {
|
||||
std::string query = StringFormat("SELECT COUNT(*) FROM `character_corpses` WHERE `charid` = '%u'", char_id);
|
||||
auto results = QueryDatabase(query);
|
||||
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
return atoi(row[0]);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint32 ZoneDatabase::GetCharacterCorpseID(uint32 char_id, uint8 corpse) {
|
||||
std::string query = StringFormat("SELECT `id` FROM `character_corpses` WHERE `charid` = '%u'", char_id);
|
||||
auto results = QueryDatabase(query);
|
||||
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
for (int i = 0; i < corpse; i++) {
|
||||
return atoll(row[0]);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint32 ZoneDatabase::GetCharacterCorpseItemCount(uint32 corpse_id){
|
||||
std::string query = StringFormat("SELECT COUNT(*) FROM character_corpse_items WHERE `corpse_id` = %u",
|
||||
corpse_id
|
||||
);
|
||||
auto results = QueryDatabase(query);
|
||||
auto row = results.begin();
|
||||
if (results.Success() && results.RowsAffected() != 0){
|
||||
return atoi(row[0]);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint32 ZoneDatabase::GetCharacterCorpseItemAt(uint32 corpse_id, uint16 slotid) {
|
||||
Corpse* tmp = LoadCharacterCorpse(corpse_id);
|
||||
uint32 itemid = 0;
|
||||
|
||||
if (tmp) {
|
||||
itemid = tmp->GetWornItem(slotid);
|
||||
tmp->DepopCorpse();
|
||||
}
|
||||
return itemid;
|
||||
}
|
||||
|
||||
bool ZoneDatabase::LoadCharacterCorpseData(uint32 corpse_id, PlayerCorpse_Struct* pcs){
|
||||
std::string query = StringFormat(
|
||||
"SELECT \n"
|
||||
"is_locked, \n"
|
||||
"exp, \n"
|
||||
"size, \n"
|
||||
"`level`, \n"
|
||||
"race, \n"
|
||||
"gender, \n"
|
||||
"class, \n"
|
||||
"deity, \n"
|
||||
"texture, \n"
|
||||
"helm_texture, \n"
|
||||
"copper, \n"
|
||||
"silver, \n"
|
||||
"gold, \n"
|
||||
"platinum, \n"
|
||||
"hair_color, \n"
|
||||
"beard_color, \n"
|
||||
"eye_color_1, \n"
|
||||
"eye_color_2, \n"
|
||||
"hair_style, \n"
|
||||
"face, \n"
|
||||
"beard, \n"
|
||||
"drakkin_heritage,\n"
|
||||
"drakkin_tattoo, \n"
|
||||
"drakkin_details, \n"
|
||||
"wc_1, \n"
|
||||
"wc_2, \n"
|
||||
"wc_3, \n"
|
||||
"wc_4, \n"
|
||||
"wc_5, \n"
|
||||
"wc_6, \n"
|
||||
"wc_7, \n"
|
||||
"wc_8, \n"
|
||||
"wc_9 \n"
|
||||
"FROM \n"
|
||||
"character_corpses\n"
|
||||
"WHERE `id` = %u LIMIT 1\n",
|
||||
corpse_id
|
||||
);
|
||||
auto results = QueryDatabase(query);
|
||||
uint16 i = 0;
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
pcs->locked = atoi(row[i++]); // is_locked,
|
||||
pcs->exp = atoll(row[i++]); // exp,
|
||||
pcs->size = atoi(row[i++]); // size,
|
||||
pcs->level = atoi(row[i++]); // `level`,
|
||||
pcs->race = atoi(row[i++]); // race,
|
||||
pcs->gender = atoi(row[i++]); // gender,
|
||||
pcs->class_ = atoi(row[i++]); // class,
|
||||
pcs->deity = atoi(row[i++]); // deity,
|
||||
pcs->texture = atoi(row[i++]); // texture,
|
||||
pcs->helmtexture = atoi(row[i++]); // helm_texture,
|
||||
pcs->copper = atoll(row[i++]); // copper,
|
||||
pcs->silver = atoll(row[i++]); // silver,
|
||||
pcs->gold = atoll(row[i++]); // gold,
|
||||
pcs->plat = atoll(row[i++]); // platinum,
|
||||
pcs->haircolor = atoi(row[i++]); // hair_color,
|
||||
pcs->beardcolor = atoi(row[i++]); // beard_color,
|
||||
pcs->eyecolor1 = atoi(row[i++]); // eye_color_1,
|
||||
pcs->eyecolor2 = atoi(row[i++]); // eye_color_2,
|
||||
pcs->hairstyle = atoi(row[i++]); // hair_style,
|
||||
pcs->face = atoi(row[i++]); // face,
|
||||
pcs->beard = atoi(row[i++]); // beard,
|
||||
pcs->drakkin_heritage = atoll(row[i++]); // drakkin_heritage,
|
||||
pcs->drakkin_tattoo = atoll(row[i++]); // drakkin_tattoo,
|
||||
pcs->drakkin_details = atoll(row[i++]); // drakkin_details,
|
||||
pcs->item_tint[0].color = atoll(row[i++]); // wc_1,
|
||||
pcs->item_tint[1].color = atoll(row[i++]); // wc_2,
|
||||
pcs->item_tint[2].color = atoll(row[i++]); // wc_3,
|
||||
pcs->item_tint[3].color = atoll(row[i++]); // wc_4,
|
||||
pcs->item_tint[4].color = atoll(row[i++]); // wc_5,
|
||||
pcs->item_tint[5].color = atoll(row[i++]); // wc_6,
|
||||
pcs->item_tint[6].color = atoll(row[i++]); // wc_7,
|
||||
pcs->item_tint[7].color = atoll(row[i++]); // wc_8,
|
||||
pcs->item_tint[8].color = atoll(row[i++]); // wc_9
|
||||
}
|
||||
query = StringFormat(
|
||||
"SELECT \n"
|
||||
"equip_slot, \n"
|
||||
"item_id, \n"
|
||||
"charges, \n"
|
||||
"aug_1, \n"
|
||||
"aug_2, \n"
|
||||
"aug_3, \n"
|
||||
"aug_4, \n"
|
||||
"aug_5, \n"
|
||||
"attuned \n"
|
||||
"FROM \n"
|
||||
"character_corpse_items \n"
|
||||
"WHERE `corpse_id` = %u\n"
|
||||
// "ORDER BY `equip_slot`"
|
||||
,
|
||||
corpse_id
|
||||
);
|
||||
results = QueryDatabase(query);
|
||||
|
||||
i = 0;
|
||||
pcs->itemcount = results.RowCount();
|
||||
uint16 r = 0;
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
memset(&pcs->items[i], 0, sizeof (player_lootitem::ServerLootItem_Struct));
|
||||
pcs->items[i].equip_slot = atoi(row[r++]); // equip_slot,
|
||||
pcs->items[i].item_id = atoll(row[r++]); // item_id,
|
||||
pcs->items[i].charges = atoi(row[r++]); // charges,
|
||||
pcs->items[i].aug_1 = atoi(row[r++]); // aug_1,
|
||||
pcs->items[i].aug_2 = atoi(row[r++]); // aug_2,
|
||||
pcs->items[i].aug_3 = atoi(row[r++]); // aug_3,
|
||||
pcs->items[i].aug_4 = atoi(row[r++]); // aug_4,
|
||||
pcs->items[i].aug_5 = atoi(row[r++]); // aug_5,
|
||||
r = 0;
|
||||
i++;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Corpse* ZoneDatabase::SummonBuriedCharacterCorpses(uint32 char_id, uint32 dest_zone_id, uint16 dest_instance_id, float dest_x, float dest_y, float dest_z, float dest_heading) {
|
||||
Corpse* NewCorpse = 0;
|
||||
std::string query = StringFormat(
|
||||
"SELECT `id`, `charname`, `time_of_death`, `is_rezzed` FROM `character_corpses` WHERE `charid` = '%u' AND `is_buried` = 1 ORDER BY `time_of_death` LIMIT 1",
|
||||
char_id
|
||||
);
|
||||
auto results = QueryDatabase(query);
|
||||
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
NewCorpse = Corpse::LoadFromDBData(
|
||||
atoll(row[0]), // uint32 in_dbid
|
||||
char_id, // uint32 in_charid
|
||||
row[1], // char* in_charname
|
||||
dest_x, // float in_x
|
||||
dest_y, // float in_y
|
||||
dest_z, // float in_z
|
||||
dest_heading, // float in_heading
|
||||
row[2], // char* time_of_death
|
||||
atoi(row[3]) == 1, // bool rezzed
|
||||
false // bool was_at_graveyard
|
||||
);
|
||||
if (NewCorpse) {
|
||||
entity_list.AddCorpse(NewCorpse);
|
||||
NewCorpse->SetDecayTimer(RuleI(Character, CorpseDecayTimeMS));
|
||||
NewCorpse->Spawn();
|
||||
if (!UnburyCharacterCorpse(NewCorpse->GetDBID(), dest_zone_id, dest_instance_id, dest_x, dest_y, dest_z, dest_heading))
|
||||
LogFile->write(EQEMuLog::Error, "Unable to unbury a summoned player corpse for character id %u.", char_id);
|
||||
}
|
||||
}
|
||||
|
||||
return NewCorpse;
|
||||
}
|
||||
|
||||
bool ZoneDatabase::SummonAllCharacterCorpses(uint32 char_id, uint32 dest_zone_id, uint16 dest_instance_id, float dest_x, float dest_y, float dest_z, float dest_heading) {
|
||||
Corpse* NewCorpse = 0;
|
||||
int CorpseCount = 0;
|
||||
|
||||
std::string query = StringFormat(
|
||||
"UPDATE character_corpses SET zone_id = %i, instance_id = %i, x = %f, y = %f, z = %f, heading = %f, is_buried = 0, was_at_graveyard = 0 WHERE charid = %i",
|
||||
dest_zone_id, dest_instance_id, dest_x, dest_y, dest_z, dest_heading, char_id
|
||||
);
|
||||
auto results = QueryDatabase(query);
|
||||
|
||||
query = StringFormat(
|
||||
"SELECT `id`, `charname`, `time_of_death`, `is_rezzed` FROM `character_corpses` WHERE `charid` = '%u'"
|
||||
"ORDER BY time_of_death",
|
||||
char_id
|
||||
);
|
||||
results = QueryDatabase(query);
|
||||
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
NewCorpse = Corpse::LoadFromDBData(
|
||||
atoll(row[0]),
|
||||
char_id,
|
||||
row[1],
|
||||
dest_x,
|
||||
dest_y,
|
||||
dest_z,
|
||||
dest_heading,
|
||||
row[2],
|
||||
atoi(row[3]) == 1,
|
||||
false);
|
||||
if (NewCorpse) {
|
||||
entity_list.AddCorpse(NewCorpse);
|
||||
NewCorpse->SetDecayTimer(RuleI(Character, CorpseDecayTimeMS));
|
||||
NewCorpse->Spawn();
|
||||
++CorpseCount;
|
||||
}
|
||||
else{
|
||||
LogFile->write(EQEMuLog::Error, "Unable to construct a player corpse for character id %u.", char_id);
|
||||
}
|
||||
}
|
||||
|
||||
return (CorpseCount > 0);
|
||||
}
|
||||
|
||||
bool ZoneDatabase::UnburyCharacterCorpse(uint32 db_id, uint32 new_zone_id, uint16 new_instance_id, float new_x, float new_y, float new_z, float new_heading) {
|
||||
std::string query = StringFormat(
|
||||
"UPDATE `character_corpses` SET `is_buried` = 0, `zone_id` = %u, `instance_id` = %u, `x` = %f, `y` = %f, `z` = %f, `heading` = %f, `time_of_death` = Now(), `was_at_graveyard` = 0 WHERE `id` = %u",
|
||||
new_zone_id, new_instance_id, new_x, new_y, new_z, new_heading, db_id
|
||||
);
|
||||
auto results = QueryDatabase(query);
|
||||
if (results.Success() && results.RowsAffected() != 0){
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
Corpse* ZoneDatabase::LoadCharacterCorpse(uint32 player_corpse_id) {
|
||||
Corpse* NewCorpse = 0;
|
||||
std::string query = StringFormat(
|
||||
"SELECT `id`, `charid`, `charname`, `x`, `y`, `z`, `heading`, `time_of_death`, `is_rezzed`, `was_at_graveyard` FROM `character_corpses` WHERE `id` = '%u' LIMIT 1",
|
||||
player_corpse_id
|
||||
);
|
||||
auto results = QueryDatabase(query);
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
NewCorpse = Corpse::LoadFromDBData(
|
||||
atoll(row[0]), // id uint32 in_dbid
|
||||
atoll(row[1]), // charid uint32 in_charid
|
||||
row[2], // char_name
|
||||
atof(row[3]), // x float in_x
|
||||
atof(row[4]), // y float in_y
|
||||
atof(row[5]), // z float in_z
|
||||
atof(row[6]), // heading float in_heading
|
||||
row[7], // time_of_death char* time_of_death
|
||||
atoi(row[8]) == 1, // is_rezzed bool rezzed
|
||||
atoi(row[9]) // was_at_graveyard bool was_at_graveyard
|
||||
);
|
||||
entity_list.AddCorpse(NewCorpse);
|
||||
}
|
||||
return NewCorpse;
|
||||
}
|
||||
|
||||
bool ZoneDatabase::LoadCharacterCorpses(uint32 zone_id, uint16 instance_id) {
|
||||
std::string query;
|
||||
if (!RuleB(Zone, EnableShadowrest)){
|
||||
query = StringFormat("SELECT id, charid, charname, x, y, z, heading, time_of_death, is_rezzed, was_at_graveyard FROM character_corpses WHERE zone_id='%u' AND instance_id='%u'", zone_id, instance_id);
|
||||
}
|
||||
else{
|
||||
query = StringFormat("SELECT id, charid, charname, x, y, z, heading, time_of_death, is_rezzed, 0 as was_at_graveyard FROM character_corpses WHERE zone_id='%u' AND instance_id='%u' AND is_buried=0", zone_id, instance_id);
|
||||
}
|
||||
|
||||
auto results = QueryDatabase(query);
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
// std::cout << row[0] << std::endl;
|
||||
// std::cout << row[1] << std::endl;
|
||||
// std::cout << row[2] << std::endl;
|
||||
// std::cout << row[3] << std::endl;
|
||||
// std::cout << row[4] << std::endl;
|
||||
// std::cout << row[5] << std::endl;
|
||||
// std::cout << row[6] << std::endl;
|
||||
// std::cout << row[7] << std::endl;
|
||||
// std::cout << row[8] << std::endl;
|
||||
// std::cout << row[9] << std::endl;
|
||||
|
||||
entity_list.AddCorpse(
|
||||
Corpse::LoadFromDBData(
|
||||
atoll(row[0]), // id uint32 in_dbid
|
||||
atoll(row[1]), // charid uint32 in_charid
|
||||
row[2], // char_name
|
||||
atof(row[3]), // x float in_x
|
||||
atof(row[4]), // y float in_y
|
||||
atof(row[5]), // z float in_z
|
||||
atof(row[6]), // heading float in_heading
|
||||
row[7], // time_of_death char* time_of_death
|
||||
atoi(row[8]) == 1, // is_rezzed bool rezzed
|
||||
atoi(row[9]))
|
||||
);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
uint32 ZoneDatabase::GetFirstCorpseID(uint32 char_id) {
|
||||
std::string query = StringFormat("SELECT `id` FROM `character_corpses` WHERE `charid` = '%u' AND `is_buried` = 0 ORDER BY `time_of_death` LIMIT 1", char_id);
|
||||
auto results = QueryDatabase(query);
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
return atoi(row[0]);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool ZoneDatabase::ClearCorpseItems(uint32 db_id){
|
||||
std::string query = StringFormat("DELETE FROM `character_corpse_items` WHERE `corpse_id` = %u", db_id);
|
||||
auto results = QueryDatabase(query);
|
||||
if (results.Success() && results.RowsAffected() != 0){
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ZoneDatabase::DeleteItemOffCharacterCorpse(uint32 db_id, uint32 equip_slot, uint32 item_id){
|
||||
std::string query = StringFormat("DELETE FROM `character_corpse_items` WHERE `corpse_id` = %u AND equip_slot = %u AND item_id = %u", db_id, equip_slot, item_id);
|
||||
auto results = QueryDatabase(query);
|
||||
if (results.Success() && results.RowsAffected() != 0){
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ZoneDatabase::BuryCharacterCorpse(uint32 db_id) {
|
||||
std::string query = StringFormat("UPDATE `character_corpses` SET `is_buried` = 1 WHERE `id` = %u", db_id);
|
||||
auto results = QueryDatabase(query);
|
||||
if (results.Success() && results.RowsAffected() != 0){
|
||||
ClearCorpseItems(db_id);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ZoneDatabase::BuryAllCharacterCorpses(uint32 char_id) {
|
||||
std::string query = StringFormat("SELECT `id` FROM `character_corpses` WHERE `charid` = %u", char_id);
|
||||
auto results = QueryDatabase(query);
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
BuryCharacterCorpse(atoi(row[0]));
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ZoneDatabase::DeleteCharacterCorpse(uint32 db_id) {
|
||||
std::string query = StringFormat("DELETE FROM `character_corpses` WHERE `id` = %d", db_id);
|
||||
auto results = QueryDatabase(query);
|
||||
if (results.Success() && results.RowsAffected() != 0){
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
254
zone/zonedb.h
254
zone/zonedb.h
@ -214,7 +214,7 @@ public:
|
||||
ZoneDatabase(const char* host, const char* user, const char* passwd, const char* database,uint32 port);
|
||||
virtual ~ZoneDatabase();
|
||||
|
||||
/* Objects and World Containers */
|
||||
/* Objects and World Containers */
|
||||
void LoadWorldContainer(uint32 parentid, ItemInst* container);
|
||||
void SaveWorldContainer(uint32 zone_id, uint32 parent_id, const ItemInst* container);
|
||||
void DeleteWorldContainer(uint32 parent_id,uint32 zone_id);
|
||||
@ -223,23 +223,24 @@ public:
|
||||
void DeleteObject(uint32 id);
|
||||
Ground_Spawns* LoadGroundSpawns(uint32 zone_id, int16 version, Ground_Spawns* gs);
|
||||
|
||||
/* Traders */
|
||||
/* Traders */
|
||||
void SaveTraderItem(uint32 char_id,uint32 itemid,uint32 uniqueid, int32 charges,uint32 itemcost,uint8 slot);
|
||||
void UpdateTraderItemCharges(int char_id, uint32 ItemInstID, int32 charges);
|
||||
void UpdateTraderItemPrice(int CharID, uint32 ItemID, uint32 Charges, uint32 NewPrice);
|
||||
ItemInst* LoadSingleTraderItem(uint32 char_id, int uniqueid);
|
||||
void UpdateTraderItemPrice(int CharID, uint32 ItemID, uint32 Charges, uint32 NewPrice);
|
||||
void DeleteTraderItem(uint32 char_id);
|
||||
void DeleteTraderItem(uint32 char_id,uint16 slot_id);
|
||||
|
||||
ItemInst* LoadSingleTraderItem(uint32 char_id, int uniqueid);
|
||||
Trader_Struct* LoadTraderItem(uint32 char_id);
|
||||
TraderCharges_Struct* LoadTraderItemWithCharges(uint32 char_id);
|
||||
|
||||
/* Buyer/Barter */
|
||||
/* Buyer/Barter */
|
||||
void AddBuyLine(uint32 CharID, uint32 BuySlot, uint32 ItemID, const char *ItemName, uint32 Quantity, uint32 Price);
|
||||
void RemoveBuyLine(uint32 CharID, uint32 BuySlot);
|
||||
void DeleteBuyLines(uint32 CharID);
|
||||
void UpdateBuyLine(uint32 CharID, uint32 BuySlot, uint32 Quantity);
|
||||
|
||||
/* General Character Related Stuff */
|
||||
/* General Character Related Stuff */
|
||||
bool SetServerFilters(char* name, ServerSideFilters_Struct *ssfs);
|
||||
uint32 GetServerFilters(char* name, ServerSideFilters_Struct *ssfs);
|
||||
|
||||
@ -249,7 +250,7 @@ public:
|
||||
void SavePetInfo(Client *c);
|
||||
void RemoveTempFactions(Client *c);
|
||||
|
||||
/* Character Data Loaders */
|
||||
/* Character Data Loaders */
|
||||
bool LoadCharacterFactionValues(uint32 character_id, faction_map & val_list);
|
||||
bool LoadCharacterSpellBook(uint32 character_id, PlayerProfile_Struct* pp);
|
||||
bool LoadCharacterMemmedSpells(uint32 character_id, PlayerProfile_Struct* pp);
|
||||
@ -265,14 +266,14 @@ public:
|
||||
bool LoadCharacterPotions(uint32 character_id, PlayerProfile_Struct* pp);
|
||||
bool LoadCharacterLeadershipAA(uint32 character_id, PlayerProfile_Struct* pp);
|
||||
|
||||
/* Character Data Saves */
|
||||
/* Character Data Saves */
|
||||
bool SaveCharacterBindPoint(uint32 character_id, uint32 zone_id, uint32 instance_id, float x, float y, float z, float heading, uint8 is_home);
|
||||
bool SaveCharacterCurrency(uint32 character_id, PlayerProfile_Struct* pp);
|
||||
bool SaveCharacterData(uint32 character_id, uint32 account_id, PlayerProfile_Struct* pp, ExtendedProfile_Struct* m_epp);
|
||||
bool SaveCharacterAA(uint32 character_id, uint32 aa_id, uint32 current_level);
|
||||
bool SaveCharacterSpell(uint32 character_id, uint32 spell_id, uint32 slot_id);
|
||||
bool SaveCharacterMemorizedSpell(uint32 character_id, uint32 spell_id, uint32 slot_id);
|
||||
bool SaveCharacterMaterialColor(uint32 character_id, uint32 slot_id, uint32 color);
|
||||
bool SaveCharacterMaterialColor(uint32 character_id, uint32 slot_id, uint32 color);
|
||||
bool SaveCharacterSkill(uint32 character_id, uint32 skill_id, uint32 value);
|
||||
bool SaveCharacterLanguage(uint32 character_id, uint32 lang_id, uint32 value);
|
||||
bool SaveCharacterDisc(uint32 character_id, uint32 slot_id, uint32 disc_id);
|
||||
@ -281,120 +282,125 @@ public:
|
||||
bool SaveCharacterPotionBelt(uint32 character_id, uint8 potion_id, uint32 item_id, uint32 icon);
|
||||
bool SaveCharacterLeadershipAA(uint32 character_id, PlayerProfile_Struct* pp);
|
||||
|
||||
/* Character Data Deletes */
|
||||
/* Character Data Deletes */
|
||||
bool DeleteCharacterSpell(uint32 character_id, uint32 spell_id, uint32 slot_id);
|
||||
bool DeleteCharacterMemorizedSpell(uint32 character_id, uint32 spell_id, uint32 slot_id);
|
||||
bool DeleteCharacterDisc(uint32 character_id, uint32 slot_id);
|
||||
bool DeleteCharacterDisc(uint32 character_id, uint32 slot_id);
|
||||
bool DeleteCharacterBandolier(uint32 character_id, uint32 band_id);
|
||||
bool DeleteCharacterLeadershipAAs(uint32 character_id);
|
||||
bool DeleteCharacterAAs(uint32 character_id);
|
||||
bool DeleteCharacterDye(uint32 character_id);
|
||||
|
||||
/* Character Inventory */
|
||||
/* Character Inventory */
|
||||
bool NoRentExpired(const char* name);
|
||||
|
||||
/* Corpses */
|
||||
bool GetDecayTimes(npcDecayTimes_Struct* npcCorpseDecayTimes);
|
||||
uint32 CreatePlayerCorpse(uint32 charid, const char* charname, uint32 zoneid, uint16 instanceid, uchar* data, uint32 datasize, float x, float y, float z, float heading);
|
||||
bool CreatePlayerCorpseBackup(uint32 dbid, uint32 charid, const char* charname, uint32 zoneid, uint16 instanceid, uchar* data, uint32 datasize, float x, float y, float z, float heading);
|
||||
uint32 UpdatePlayerCorpse(uint32 dbid, uint32 charid, const char* charname, uint32 zoneid, uint16 instanceid, uchar* data, uint32 datasize, float x, float y, float z, float heading, bool rezzed = false);
|
||||
void MarkCorpseAsRezzed(uint32 dbid);
|
||||
bool BuryPlayerCorpse(uint32 dbid);
|
||||
bool BuryAllPlayerCorpses(uint32 charid);
|
||||
bool DeletePlayerCorpse(uint32 dbid);
|
||||
uint32 GetPlayerBurriedCorpseCount(uint32 char_id);
|
||||
Corpse* SummonBurriedPlayerCorpse(uint32 char_id, uint32 dest_zoneid, uint16 dest_instanceid, float dest_x, float dest_y, float dest_z, float dest_heading);
|
||||
bool SummonAllPlayerCorpses(uint32 char_id, uint32 dest_zoneid, uint16 dest_instanceid, float dest_x, float dest_y, float dest_z, float dest_heading);
|
||||
bool SummonAllGraveyardCorpses(uint32 cur_zoneid, uint32 dest_zoneid, uint16 dest_instanceid, float dest_x, float dest_y, float dest_z, float dest_heading);
|
||||
Corpse* LoadPlayerCorpse(uint32 player_corpse_id);
|
||||
bool UnburyPlayerCorpse(uint32 dbid, uint32 new_zoneid, uint16 dest_instanceid, float new_x, float new_y, float new_z, float new_heading);
|
||||
bool LoadPlayerCorpses(uint32 iZoneID, uint16 iInstanceID);
|
||||
uint32 GraveyardPlayerCorpse(uint32 dbid, uint32 zoneid, uint16 instanceid, float x, float y, float z, float heading);
|
||||
uint32 NewGraveyardRecord(uint32 graveyard_zoneid, float graveyard_x, float graveyard_y, float graveyard_z, float graveyard_heading);
|
||||
uint32 AddGraveyardIDToZone(uint32 zone_id, uint32 graveyard_id);
|
||||
bool DeleteGraveyard(uint32 zone_id, uint32 graveyard_id);
|
||||
uint32 GetFirstCorpseID(uint32 char_id);
|
||||
uint32 GetPlayerCorpseCount(uint32 char_id);
|
||||
uint32 GetPlayerCorpseID(uint32 char_id, uint8 corpse);
|
||||
uint32 GetPlayerCorpseItemAt(uint32 corpse_id, uint16 slotid);
|
||||
uint32 GetPlayerCorpseTimeLeft(uint8 corpse, uint8 type);
|
||||
/* Corpses */
|
||||
bool ClearCorpseItems(uint32 db_id);
|
||||
bool DeleteItemOffCharacterCorpse(uint32 db_id, uint32 equip_slot, uint32 item_id);
|
||||
uint32 GetCharacterCorpseItemCount(uint32 corpse_id);
|
||||
bool LoadCharacterCorpseData(uint32 corpse_id, PlayerCorpse_Struct* pcs);
|
||||
Corpse* LoadCharacterCorpse(uint32 player_corpse_id);
|
||||
Corpse* SummonBuriedCharacterCorpses(uint32 char_id, uint32 dest_zoneid, uint16 dest_instanceid, float dest_x, float dest_y, float dest_z, float dest_heading);
|
||||
void MarkCorpseAsRezzed(uint32 dbid);
|
||||
bool GetDecayTimes(npcDecayTimes_Struct* npcCorpseDecayTimes);
|
||||
bool BuryCharacterCorpse(uint32 dbid);
|
||||
bool BuryAllCharacterCorpses(uint32 charid);
|
||||
bool DeleteCharacterCorpse(uint32 dbid);
|
||||
bool SummonAllCharacterCorpses(uint32 char_id, uint32 dest_zoneid, uint16 dest_instanceid, float dest_x, float dest_y, float dest_z, float dest_heading);
|
||||
bool SummonAllGraveyardCorpses(uint32 cur_zoneid, uint32 dest_zoneid, uint16 dest_instanceid, float dest_x, float dest_y, float dest_z, float dest_heading);
|
||||
bool UnburyCharacterCorpse(uint32 dbid, uint32 new_zoneid, uint16 dest_instanceid, float new_x, float new_y, float new_z, float new_heading);
|
||||
bool LoadCharacterCorpses(uint32 iZoneID, uint16 iInstanceID);
|
||||
bool DeleteGraveyard(uint32 zone_id, uint32 graveyard_id);
|
||||
uint32 GetCharacterCorpseDecayTimer(uint32 corpse_db_id);
|
||||
uint32 GetCharacterBuriedCorpseCount(uint32 char_id);
|
||||
uint32 SendCharacterCorpseToGraveyard(uint32 dbid, uint32 zoneid, uint16 instanceid, float x, float y, float z, float heading);
|
||||
uint32 CreateGraveyardRecord(uint32 graveyard_zoneid, float graveyard_x, float graveyard_y, float graveyard_z, float graveyard_heading);
|
||||
uint32 AddGraveyardIDToZone(uint32 zone_id, uint32 graveyard_id);
|
||||
uint32 SaveCharacterCorpse(uint32 charid, const char* charname, uint32 zoneid, uint16 instanceid, PlayerCorpse_Struct* dbpc, float x, float y, float z, float heading);
|
||||
uint32 UpdateCharacterCorpse(uint32 dbid, uint32 charid, const char* charname, uint32 zoneid, uint16 instanceid, PlayerCorpse_Struct* dbpc, float x, float y, float z, float heading, bool rezzed = false);
|
||||
uint32 GetFirstCorpseID(uint32 char_id);
|
||||
uint32 GetCharacterCorpseCount(uint32 char_id);
|
||||
uint32 GetCharacterCorpseID(uint32 char_id, uint8 corpse);
|
||||
uint32 GetCharacterCorpseItemAt(uint32 corpse_id, uint16 slotid);
|
||||
uint32 GetPlayerCorpseTimeLeft(uint8 corpse, uint8 type);
|
||||
|
||||
/* Faction */
|
||||
bool GetNPCFactionList(uint32 npcfaction_id, int32* faction_id, int32* value, uint8* temp, int32* primary_faction = 0);
|
||||
bool GetFactionData(FactionMods* fd, uint32 class_mod, uint32 race_mod, uint32 deity_mod, int32 faction_id); //needed for factions Dec, 16 2001
|
||||
bool GetFactionName(int32 faction_id, char* name, uint32 buflen); // needed for factions Dec, 16 2001
|
||||
bool GetFactionIdsForNPC(uint32 nfl_id, std::list<struct NPCFaction*> *faction_list, int32* primary_faction = 0); // improve faction handling
|
||||
bool SetCharacterFactionLevel(uint32 char_id, int32 faction_id, int32 value, uint8 temp, faction_map &val_list); // needed for factions Dec, 16 2001
|
||||
bool LoadFactionData();
|
||||
/* Faction */
|
||||
bool GetNPCFactionList(uint32 npcfaction_id, int32* faction_id, int32* value, uint8* temp, int32* primary_faction = 0);
|
||||
bool GetFactionData(FactionMods* fd, uint32 class_mod, uint32 race_mod, uint32 deity_mod, int32 faction_id); //needed for factions Dec, 16 2001
|
||||
bool GetFactionName(int32 faction_id, char* name, uint32 buflen); // needed for factions Dec, 16 2001
|
||||
bool GetFactionIdsForNPC(uint32 nfl_id, std::list<struct NPCFaction*> *faction_list, int32* primary_faction = 0); // improve faction handling
|
||||
bool SetCharacterFactionLevel(uint32 char_id, int32 faction_id, int32 value, uint8 temp, faction_map &val_list); // needed for factions Dec, 16 2001
|
||||
bool LoadFactionData();
|
||||
|
||||
/* AAs */
|
||||
bool LoadAAEffects();
|
||||
bool LoadAAEffects2();
|
||||
bool LoadSwarmSpells();
|
||||
SendAA_Struct* GetAASkillVars(uint32 skill_id);
|
||||
uint8 GetTotalAALevels(uint32 skill_id);
|
||||
uint32 GetSizeAA();
|
||||
uint32 CountAAs();
|
||||
void LoadAAs(SendAA_Struct **load);
|
||||
uint32 CountAAEffects();
|
||||
void FillAAEffects(SendAA_Struct* aa_struct);
|
||||
/* AAs */
|
||||
bool LoadAAEffects();
|
||||
bool LoadAAEffects2();
|
||||
bool LoadSwarmSpells();
|
||||
SendAA_Struct*GetAASkillVars(uint32 skill_id);
|
||||
uint8 GetTotalAALevels(uint32 skill_id);
|
||||
uint32 GetSizeAA();
|
||||
uint32 CountAAs();
|
||||
void LoadAAs(SendAA_Struct **load);
|
||||
uint32 CountAAEffects();
|
||||
void FillAAEffects(SendAA_Struct* aa_struct);
|
||||
|
||||
/* Zone related */
|
||||
bool GetZoneCFG(uint32 zoneid, uint16 instance_id, NewZone_Struct *data, bool &can_bind, bool &can_combat, bool &can_levitate, bool &can_castoutdoor, bool &is_city, bool &is_hotzone, bool &allow_mercs, uint8 &zone_type, int &ruleset, char **map_filename);
|
||||
bool SaveZoneCFG(uint32 zoneid, uint16 instance_id, NewZone_Struct* zd);
|
||||
bool LoadStaticZonePoints(LinkedList<ZonePoint*>* zone_point_list,const char* zonename, uint32 version);
|
||||
bool UpdateZoneSafeCoords(const char* zonename, float x, float y, float z);
|
||||
uint8 GetUseCFGSafeCoords();
|
||||
int getZoneShutDownDelay(uint32 zoneID, uint32 version);
|
||||
/* Zone related */
|
||||
bool GetZoneCFG(uint32 zoneid, uint16 instance_id, NewZone_Struct *data, bool &can_bind, bool &can_combat, bool &can_levitate, bool &can_castoutdoor, bool &is_city, bool &is_hotzone, bool &allow_mercs, uint8 &zone_type, int &ruleset, char **map_filename);
|
||||
bool SaveZoneCFG(uint32 zoneid, uint16 instance_id, NewZone_Struct* zd);
|
||||
bool LoadStaticZonePoints(LinkedList<ZonePoint*>* zone_point_list,const char* zonename, uint32 version);
|
||||
bool UpdateZoneSafeCoords(const char* zonename, float x, float y, float z);
|
||||
uint8 GetUseCFGSafeCoords();
|
||||
int getZoneShutDownDelay(uint32 zoneID, uint32 version);
|
||||
|
||||
/* Spawns and Spawn Points */
|
||||
bool LoadSpawnGroups(const char* zone_name, uint16 version, SpawnGroupList* spawn_group_list);
|
||||
bool LoadSpawnGroupsByID(int spawngroupid, SpawnGroupList* spawn_group_list);
|
||||
bool PopulateZoneSpawnList(uint32 zoneid, LinkedList<Spawn2*> &spawn2_list, int16 version, uint32 repopdelay = 0);
|
||||
Spawn2* LoadSpawn2(LinkedList<Spawn2*> &spawn2_list, uint32 spawn2id, uint32 timeleft);
|
||||
bool CreateSpawn2(Client *c, uint32 spawngroup, const char* zone, float heading, float x, float y, float z, uint32 respawn, uint32 variance, uint16 condition, int16 cond_value);
|
||||
void UpdateSpawn2Timeleft(uint32 id, uint16 instance_id,uint32 timeleft);
|
||||
uint32 GetSpawnTimeLeft(uint32 id, uint16 instance_id);
|
||||
void UpdateSpawn2Status(uint32 id, uint8 new_status);
|
||||
/* Spawns and Spawn Points */
|
||||
bool LoadSpawnGroups(const char* zone_name, uint16 version, SpawnGroupList* spawn_group_list);
|
||||
bool LoadSpawnGroupsByID(int spawngroupid, SpawnGroupList* spawn_group_list);
|
||||
bool PopulateZoneSpawnList(uint32 zoneid, LinkedList<Spawn2*> &spawn2_list, int16 version, uint32 repopdelay = 0);
|
||||
Spawn2* LoadSpawn2(LinkedList<Spawn2*> &spawn2_list, uint32 spawn2id, uint32 timeleft);
|
||||
bool CreateSpawn2(Client *c, uint32 spawngroup, const char* zone, float heading, float x, float y, float z, uint32 respawn, uint32 variance, uint16 condition, int16 cond_value);
|
||||
void UpdateSpawn2Timeleft(uint32 id, uint16 instance_id,uint32 timeleft);
|
||||
uint32 GetSpawnTimeLeft(uint32 id, uint16 instance_id);
|
||||
void UpdateSpawn2Status(uint32 id, uint8 new_status);
|
||||
|
||||
/* Grids/Paths */
|
||||
uint32 GetFreeGrid(uint16 zoneid);
|
||||
void DeleteGrid(Client *c, uint32 sg2, uint32 grid_num, bool grid_too,uint16 zoneid);
|
||||
void DeleteWaypoint(Client *c, uint32 grid_num, uint32 wp_num,uint16 zoneid);
|
||||
// uint32 AddWP(Client *c, uint32 sg2, uint16 grid_num, uint8 wp_num, float xpos, float ypos, float zpos, uint32 pause, float xpos1, float ypos1, float zpos1, int type1, int type2,uint16 zoneid);
|
||||
void AddWP(Client *c, uint32 gridid, uint32 wpnum, float xpos, float ypos, float zpos, uint32 pause, uint16 zoneid, float heading);
|
||||
uint32 AddWPForSpawn(Client *c, uint32 spawn2id, float xpos, float ypos, float zpos, uint32 pause, int type1, int type2, uint16 zoneid, float heading);
|
||||
void ModifyGrid(Client *c, bool remove, uint32 id, uint8 type = 0, uint8 type2 = 0,uint16 zoneid = 0);
|
||||
void ModifyWP(Client *c, uint32 grid_id, uint32 wp_num, float xpos, float ypos, float zpos, uint32 script=0,uint16 zoneid =0);
|
||||
uint8 GetGridType(uint32 grid,uint32 zoneid);
|
||||
uint8 GetGridType2(uint32 grid, uint16 zoneid);
|
||||
bool GetWaypoints(uint32 grid, uint16 zoneid, uint32 num, wplist* wp);
|
||||
void AssignGrid(Client *client, float x, float y, uint32 id);
|
||||
int GetHighestGrid(uint32 zoneid);
|
||||
int GetHighestWaypoint(uint32 zoneid, uint32 gridid);
|
||||
/* Grids/Paths */
|
||||
uint32 GetFreeGrid(uint16 zoneid);
|
||||
void DeleteGrid(Client *c, uint32 sg2, uint32 grid_num, bool grid_too, uint16 zoneid);
|
||||
void DeleteWaypoint(Client *c, uint32 grid_num, uint32 wp_num, uint16 zoneid);
|
||||
void AddWP(Client *c, uint32 gridid, uint32 wpnum, float xpos, float ypos, float zpos, uint32 pause, uint16 zoneid, float heading);
|
||||
uint32 AddWPForSpawn(Client *c, uint32 spawn2id, float xpos, float ypos, float zpos, uint32 pause, int type1, int type2, uint16 zoneid, float heading);
|
||||
void ModifyGrid(Client *c, bool remove, uint32 id, uint8 type = 0, uint8 type2 = 0, uint16 zoneid = 0);
|
||||
void ModifyWP(Client *c, uint32 grid_id, uint32 wp_num, float xpos, float ypos, float zpos, uint32 script = 0, uint16 zoneid = 0);
|
||||
uint8 GetGridType(uint32 grid, uint32 zoneid);
|
||||
uint8 GetGridType2(uint32 grid, uint16 zoneid);
|
||||
bool GetWaypoints(uint32 grid, uint16 zoneid, uint32 num, wplist* wp);
|
||||
void AssignGrid(Client *client, float x, float y, uint32 id);
|
||||
int GetHighestGrid(uint32 zoneid);
|
||||
int GetHighestWaypoint(uint32 zoneid, uint32 gridid);
|
||||
|
||||
/* NPCs */
|
||||
const NPCType* GetNPCType(uint32 id);
|
||||
uint32 NPCSpawnDB(uint8 command, const char* zone, uint32 zone_version, Client *c, NPC* spawn = 0, uint32 extra = 0); // 0 = Create 1 = Add; 2 = Update; 3 = Remove; 4 = Delete
|
||||
uint32 CreateNewNPCCommand(const char* zone, uint32 zone_version, Client *client, NPC* spawn, uint32 extra);
|
||||
uint32 AddNewNPCSpawnGroupCommand(const char* zone, uint32 zone_version, Client *client, NPC* spawn, uint32 respawnTime);
|
||||
uint32 DeleteSpawnLeaveInNPCTypeTable(const char* zone, Client *client, NPC* spawn);
|
||||
uint32 DeleteSpawnRemoveFromNPCTypeTable(const char* zone, uint32 zone_version, Client *client, NPC* spawn);
|
||||
uint32 AddSpawnFromSpawnGroup(const char* zone, uint32 zone_version, Client *client, NPC* spawn, uint32 spawnGroupID);
|
||||
uint32 AddNPCTypes(const char* zone, uint32 zone_version, Client *client, NPC* spawn, uint32 spawnGroupID);
|
||||
uint32 UpdateNPCTypeAppearance(Client *client, NPC* spawn);
|
||||
bool SetSpecialAttkFlag(uint8 id, const char* flag);
|
||||
bool GetPetEntry(const char *pet_type, PetRecord *into);
|
||||
bool GetPoweredPetEntry(const char *pet_type, int16 petpower, PetRecord *into);
|
||||
bool GetBasePetItems(int32 equipmentset, uint32 *items);
|
||||
void AddLootTableToNPC(NPC* npc,uint32 loottable_id, ItemList* itemlist, uint32* copper, uint32* silver, uint32* gold, uint32* plat);
|
||||
void AddLootDropToNPC(NPC* npc,uint32 lootdrop_id, ItemList* itemlist, uint8 droplimit, uint8 mindrop);
|
||||
uint32 GetMaxNPCSpellsID();
|
||||
uint32 GetMaxNPCSpellsEffectsID();
|
||||
DBnpcspells_Struct* GetNPCSpells(uint32 iDBSpellsID);
|
||||
DBnpcspellseffects_Struct* GetNPCSpellsEffects(uint32 iDBSpellsEffectsID);
|
||||
/* NPCs */
|
||||
|
||||
uint32 NPCSpawnDB(uint8 command, const char* zone, uint32 zone_version, Client *c, NPC* spawn = 0, uint32 extra = 0); // 0 = Create 1 = Add; 2 = Update; 3 = Remove; 4 = Delete
|
||||
uint32 CreateNewNPCCommand(const char* zone, uint32 zone_version, Client *client, NPC* spawn, uint32 extra);
|
||||
uint32 AddNewNPCSpawnGroupCommand(const char* zone, uint32 zone_version, Client *client, NPC* spawn, uint32 respawnTime);
|
||||
uint32 DeleteSpawnLeaveInNPCTypeTable(const char* zone, Client *client, NPC* spawn);
|
||||
uint32 DeleteSpawnRemoveFromNPCTypeTable(const char* zone, uint32 zone_version, Client *client, NPC* spawn);
|
||||
uint32 AddSpawnFromSpawnGroup(const char* zone, uint32 zone_version, Client *client, NPC* spawn, uint32 spawnGroupID);
|
||||
uint32 AddNPCTypes(const char* zone, uint32 zone_version, Client *client, NPC* spawn, uint32 spawnGroupID);
|
||||
uint32 UpdateNPCTypeAppearance(Client *client, NPC* spawn);
|
||||
bool SetSpecialAttkFlag(uint8 id, const char* flag);
|
||||
bool GetPetEntry(const char *pet_type, PetRecord *into);
|
||||
bool GetPoweredPetEntry(const char *pet_type, int16 petpower, PetRecord *into);
|
||||
bool GetBasePetItems(int32 equipmentset, uint32 *items);
|
||||
void AddLootTableToNPC(NPC* npc, uint32 loottable_id, ItemList* itemlist, uint32* copper, uint32* silver, uint32* gold, uint32* plat);
|
||||
void AddLootDropToNPC(NPC* npc, uint32 lootdrop_id, ItemList* itemlist, uint8 droplimit, uint8 mindrop);
|
||||
uint32 GetMaxNPCSpellsID();
|
||||
uint32 GetMaxNPCSpellsEffectsID();
|
||||
|
||||
/* Mercs */
|
||||
DBnpcspells_Struct* GetNPCSpells(uint32 iDBSpellsID);
|
||||
DBnpcspellseffects_Struct* GetNPCSpellsEffects(uint32 iDBSpellsEffectsID);
|
||||
const NPCType* GetNPCType(uint32 id);
|
||||
|
||||
/* Mercs */
|
||||
const NPCType* GetMercType(uint32 id, uint16 raceid, uint32 clientlevel);
|
||||
void LoadMercEquipment(Merc *merc);
|
||||
void SaveMercBuffs(Merc *merc);
|
||||
@ -403,10 +409,8 @@ public:
|
||||
bool LoadCurrentMerc(Client *c);
|
||||
bool SaveMerc(Merc *merc);
|
||||
bool DeleteMerc(uint32 merc_id);
|
||||
//void LoadMercTypesForMercMerchant(NPC *merchant);
|
||||
//void LoadMercsForMercMerchant(NPC *merchant);
|
||||
|
||||
/* Petitions */
|
||||
/* Petitions */
|
||||
void UpdateBug(BugStruct* bug);
|
||||
void UpdateBug(PetitionBug_Struct* bug);
|
||||
void DeletePetitionFromDB(Petition* wpet);
|
||||
@ -414,23 +418,23 @@ public:
|
||||
void InsertPetitionToDB(Petition* wpet);
|
||||
void RefreshPetitionsFromDB();
|
||||
|
||||
/* Merchants */
|
||||
/* Merchants */
|
||||
void SaveMerchantTemp(uint32 npcid, uint32 slot, uint32 item, uint32 charges);
|
||||
void DeleteMerchantTemp(uint32 npcid, uint32 slot);
|
||||
|
||||
/* Tradeskills */
|
||||
/* Tradeskills */
|
||||
bool GetTradeRecipe(const ItemInst* container, uint8 c_type, uint32 some_id, uint32 char_id, DBTradeskillRecipe_Struct *spec);
|
||||
bool GetTradeRecipe(uint32 recipe_id, uint8 c_type, uint32 some_id, uint32 char_id, DBTradeskillRecipe_Struct *spec);
|
||||
uint32 GetZoneForage(uint32 ZoneID, uint8 skill); /* for foraging */
|
||||
uint32 GetZoneFishing(uint32 ZoneID, uint8 skill, uint32 &npc_id, uint8 &npc_chance);
|
||||
void UpdateRecipeMadecount(uint32 recipe_id, uint32 char_id, uint32 madecount);
|
||||
bool EnableRecipe(uint32 recipe_id);
|
||||
bool DisableRecipe(uint32 recipe_id);
|
||||
bool EnableRecipe(uint32 recipe_id);
|
||||
bool DisableRecipe(uint32 recipe_id);
|
||||
|
||||
/* Tribute */
|
||||
/* Tribute */
|
||||
bool LoadTributes();
|
||||
|
||||
/* Doors */
|
||||
/* Doors */
|
||||
bool DoorIsOpen(uint8 door_id,const char* zone_name);
|
||||
void SetDoorPlace(uint8 value,uint8 door_id,const char* zone_name);
|
||||
bool LoadDoors(int32 iDoorCount, Door *into, const char *zone_name, int16 version);
|
||||
@ -441,34 +445,34 @@ public:
|
||||
int32 GetDoorsCount(uint32* oMaxID, const char *zone_name, int16 version);
|
||||
int32 GetDoorsCountPlusOne(const char *zone_name, int16 version);
|
||||
int32 GetDoorsDBCountPlusOne(const char *zone_name, int16 version);
|
||||
void InsertDoor(uint32 did, uint16 ddoorid, const char* ddoor_name, float dxpos, float dypos, float dzpos, float dheading, uint8 dopentype, uint16 dguildid, uint32 dlockpick, uint32 dkeyitem, uint8 ddoor_param, uint8 dinvert, int dincline, uint16 dsize);
|
||||
void InsertDoor(uint32 did, uint16 ddoorid, const char* ddoor_name, float dxpos, float dypos, float dzpos, float dheading, uint8 dopentype, uint16 dguildid, uint32 dlockpick, uint32 dkeyitem, uint8 ddoor_param, uint8 dinvert, int dincline, uint16 dsize);
|
||||
|
||||
/* Blocked Spells */
|
||||
/* Blocked Spells */
|
||||
int32 GetBlockedSpellsCount(uint32 zoneid);
|
||||
bool LoadBlockedSpells(int32 blockedSpellsCount, ZoneSpellsBlocked* into, uint32 zoneid);
|
||||
|
||||
/* Traps */
|
||||
/* Traps */
|
||||
bool LoadTraps(const char* zonename, int16 version);
|
||||
char* GetTrapMessage(uint32 trap_id);
|
||||
|
||||
/* Time */
|
||||
/* Time */
|
||||
uint32 GetZoneTZ(uint32 zoneid, uint32 version);
|
||||
bool SetZoneTZ(uint32 zoneid, uint32 version, uint32 tz);
|
||||
|
||||
/* Group */
|
||||
/* Group */
|
||||
void RefreshGroupFromDB(Client *c);
|
||||
uint8 GroupCount(uint32 groupid);
|
||||
|
||||
/* Raid */
|
||||
/* Raid */
|
||||
uint8 RaidGroupCount(uint32 raidid, uint32 groupid);
|
||||
|
||||
/* Instancing */
|
||||
/* Instancing */
|
||||
void ListAllInstances(Client* c, uint32 charid);
|
||||
|
||||
/* QGlobals */
|
||||
/* QGlobals */
|
||||
void QGlobalPurge();
|
||||
|
||||
/* Alternate Currency */
|
||||
/* Alternate Currency */
|
||||
void LoadAltCurrencyValues(uint32 char_id, std::map<uint32, uint32> ¤cy);
|
||||
void UpdateAltCurrencyValue(uint32 char_id, uint32 currency_id, uint32 value);
|
||||
|
||||
|
||||
@ -35,11 +35,9 @@ spawn2 mediumblob, npcs mediumblob, npc_loot mediumblob, gmspawntype mediumblob,
|
||||
struct NPCType
|
||||
{
|
||||
char name[64];
|
||||
char lastname[70];
|
||||
|
||||
char lastname[70];
|
||||
int32 cur_hp;
|
||||
int32 max_hp;
|
||||
|
||||
int32 max_hp;
|
||||
float size;
|
||||
float runspeed;
|
||||
uint8 gender;
|
||||
@ -91,7 +89,7 @@ struct NPCType
|
||||
uint32 min_dmg;
|
||||
uint32 max_dmg;
|
||||
int16 attack_count;
|
||||
char special_abilities[512];
|
||||
char special_abilities[512];
|
||||
uint16 d_meele_texture1;
|
||||
uint16 d_meele_texture2;
|
||||
char ammo_idfile[30];
|
||||
@ -130,38 +128,30 @@ struct NPCType
|
||||
uint8 probability;
|
||||
};
|
||||
|
||||
/*
|
||||
Below are the blob structures for saving player corpses to the database
|
||||
-Quagmire
|
||||
|
||||
create table player_corpses (id int(11) unsigned not null auto_increment primary key, charid int(11) unsigned not null,
|
||||
charname varchar(30) not null, zonename varchar(16)not null, x float not null, y float not null, z float not null,
|
||||
heading float not null, data blob not null, time timestamp(14), index zonename (zonename));
|
||||
*/
|
||||
|
||||
namespace player_lootitem
|
||||
{
|
||||
namespace player_lootitem {
|
||||
struct ServerLootItem_Struct {
|
||||
uint32 item_id;
|
||||
int16 equipSlot;
|
||||
uint8 charges;
|
||||
uint16 lootslot;
|
||||
uint32 aug1;
|
||||
uint32 aug2;
|
||||
uint32 aug3;
|
||||
uint32 aug4;
|
||||
uint32 aug5;
|
||||
uint32 item_id;
|
||||
int16 equip_slot;
|
||||
uint16 charges;
|
||||
uint16 lootslot;
|
||||
uint32 aug_1;
|
||||
uint32 aug_2;
|
||||
uint32 aug_3;
|
||||
uint32 aug_4;
|
||||
uint32 aug_5;
|
||||
uint8 min_level; //
|
||||
uint8 max_level; //
|
||||
};
|
||||
}
|
||||
|
||||
struct DBPlayerCorpse_Struct {
|
||||
struct PlayerCorpse_Struct {
|
||||
uint32 crc;
|
||||
bool locked;
|
||||
uint32 itemcount;
|
||||
uint32 exp;
|
||||
float size;
|
||||
uint8 level;
|
||||
uint8 race;
|
||||
uint32 race;
|
||||
uint8 gender;
|
||||
uint8 class_;
|
||||
uint8 deity;
|
||||
@ -183,39 +173,9 @@ struct DBPlayerCorpse_Struct {
|
||||
uint32 drakkin_tattoo;
|
||||
uint32 drakkin_details;
|
||||
player_lootitem::ServerLootItem_Struct items[0];
|
||||
//std::list<player_lootitem::ServerLootItem_Struct*> items;
|
||||
};
|
||||
|
||||
namespace classic_db
|
||||
{
|
||||
struct DBPlayerCorpse_Struct {
|
||||
uint32 crc;
|
||||
bool locked;
|
||||
uint32 itemcount;
|
||||
uint32 exp;
|
||||
float size;
|
||||
uint8 level;
|
||||
uint8 race;
|
||||
uint8 gender;
|
||||
uint8 class_;
|
||||
uint8 deity;
|
||||
uint8 texture;
|
||||
uint8 helmtexture;
|
||||
uint32 copper;
|
||||
uint32 silver;
|
||||
uint32 gold;
|
||||
uint32 plat;
|
||||
Color_Struct item_tint[9];
|
||||
uint8 haircolor;
|
||||
uint8 beardcolor;
|
||||
uint8 eyecolor1;
|
||||
uint8 eyecolor2;
|
||||
uint8 hairstyle;
|
||||
uint8 face;
|
||||
uint8 beard;
|
||||
player_lootitem::ServerLootItem_Struct items[0];
|
||||
};
|
||||
}
|
||||
|
||||
struct Door {
|
||||
uint32 db_id;
|
||||
uint8 door_id;
|
||||
@ -228,7 +188,7 @@ struct Door {
|
||||
int incline;
|
||||
uint8 opentype;
|
||||
uint32 guild_id;
|
||||
uint16 lockpick;
|
||||
uint16 lock_pick;
|
||||
uint32 keyitem;
|
||||
uint8 nokeyring;
|
||||
uint8 trigger_door;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user