Beispiel #1
0
BOOL MySQLRecordTotalMoney(int total_money)
{
	BOOL					enqueued;
	sql_record_totalmoney*	record;
	sql_queue_node*			node;
	
	if (state == 0)
		return FALSE;

	// allocate
	record	= (sql_record_totalmoney*)malloc(sizeof(sql_record_totalmoney));
	node	= (sql_queue_node*)malloc(sizeof(sql_queue_node));
	
	// set values
	record->total_money = total_money;
	
	// attach to node
	node->type = STAT_TOTALMONEY;
	node->data = record;

	// try to enqueue
	enqueued = _MySQLEnqueue(node);

	// cleanup in case of fail
	if (!enqueued)
	{
		free(record);
		free(node);
	}

	return enqueued;
};
Beispiel #2
0
BOOL MySQLRecordMoneyCreated(int money_created)
{
	BOOL						enqueued;	
	sql_record_moneycreated*	record;
	sql_queue_node*				node;
	
	if (state == 0)
		return FALSE;

	// allocate
	record	= (sql_record_moneycreated*)malloc(sizeof(sql_record_moneycreated));
	node	= (sql_queue_node*)malloc(sizeof(sql_queue_node));
	
	// set values
	record->money_created = money_created;
	
	// attach to node
	node->type = STAT_MONEYCREATED;
	node->data = record;

	// try to enqueue
	enqueued = _MySQLEnqueue(node);

	// cleanup in case of fail
	if (!enqueued)
	{
		free(record);
		free(node);
	}

	return enqueued;
};
BOOL MySQLRecordGuildDisband(char* name)
{
   BOOL							      enqueued;
   sql_record_guilddisband*      record;
   sql_queue_node*					node;

   if (state == 0 || !name)
      return FALSE;

   // allocate
   record = (sql_record_guilddisband*)malloc(sizeof(sql_record_guilddisband));
   node = (sql_queue_node*)malloc(sizeof(sql_queue_node));

   // set values
   record->name = _strdup(name);

   // attach to node
   node->type = STAT_GUILDDISBAND;
   node->data = record;

   // try to enqueue
   enqueued = _MySQLEnqueue(node);

   // cleanup in case of fail
   if (!enqueued)
   {
      free(record->name);

      free(record);
      free(node);
   }

   return enqueued;
};
BOOL MySQLRecordPlayerSuicide(int account_id, char* name)
{
   BOOL							      enqueued;
   sql_record_playersuicide*		record;
   sql_queue_node*					node;

   if (state == 0 || !account_id || !name)
      return FALSE;

   // allocate
   record = (sql_record_playersuicide*)malloc(sizeof(sql_record_playersuicide));
   node = (sql_queue_node*)malloc(sizeof(sql_queue_node));

   // set values
   record->account_id = account_id;
   record->name = _strdup(name);

   // attach to node
   node->type = STAT_PLAYERSUICIDE;
   node->data = record;

   // try to enqueue
   enqueued = _MySQLEnqueue(node);

   // cleanup in case of fail
   if (!enqueued)
   {
      free(record->name);

      free(record);
      free(node);
   }

   return enqueued;
};
BOOL MySQLRecordPlayer(int account_id, char* name, char* home, char* bind, char* guild,
   int max_health, int max_mana, int might, int p_int, int myst,
   int stam, int agil, int aim)
{
   BOOL							enqueued;
   sql_record_player*		record;
   sql_queue_node*			node;

   if (state == 0 || !account_id || !name || !home || !bind || !guild || !max_health ||
      !max_mana || !might || !p_int || !myst || !stam || !agil || !aim)
      return FALSE;

   // allocate
   record = (sql_record_player*)malloc(sizeof(sql_record_player));
   node = (sql_queue_node*)malloc(sizeof(sql_queue_node));

   // set values
   record->account_id = account_id;
   record->name = _strdup(name);
   record->home = _strdup(home);
   record->bind = _strdup(bind);
   record->guild = _strdup(guild);
   record->max_health = max_health;
   record->max_mana = max_mana;
   record->might = might;
   record->p_int = p_int;
   record->myst = myst;
   record->stam = stam;
   record->agil = agil;
   record->aim = aim;

   // attach to node
   node->type = STAT_PLAYER;
   node->data = record;

   // try to enqueue
   enqueued = _MySQLEnqueue(node);

   // cleanup in case of fail
   if (!enqueued)
   {
      free(record->name);
      free(record->guild);
      free(record->home);
      free(record->bind);

      free(record);
      free(node);
   }

   return enqueued;
};
Beispiel #6
0
BOOL MySQLRecordPlayerAssessDamage(char* who, char* attacker, int aspell, int atype, int applied, int original, char* weapon)
{
	BOOL							enqueued;	
	sql_record_playerassessdamage*	record;
	sql_queue_node*					node;
	
	if (state == 0 || !who || !attacker || !weapon)
		return FALSE;

	// allocate
	record	= (sql_record_playerassessdamage*)malloc(sizeof(sql_record_playerassessdamage));
	node	= (sql_queue_node*)malloc(sizeof(sql_queue_node));
	
	// set values
	record->who			= _strdup(who);
	record->attacker	= _strdup(attacker);
	record->aspell		= aspell;
	record->atype		= atype;
	record->applied		= applied;
	record->original	= original;
	record->weapon		= _strdup(weapon);

	// attach to node
	node->type = STAT_ASSESS_DAM;
	node->data = record;

	// try to enqueue
	enqueued = _MySQLEnqueue(node);

	// cleanup in case of fail
	if (!enqueued)
	{
		free(record->who);
		free(record->attacker);
		free(record->weapon);

		free(record);
		free(node);
	}
	
	return enqueued;
};
BOOL MySQLRecordPlayerDeath(char* victim, char* killer, char* room, char* attack, int ispvp)
{
   BOOL							enqueued;
   sql_record_playerdeath*			record;
   sql_queue_node*					node;

   if (state == 0 || !victim || !killer || !room || !attack || !ispvp)
      return FALSE;

   // allocate
   record = (sql_record_playerdeath*)malloc(sizeof(sql_record_playerdeath));
   node = (sql_queue_node*)malloc(sizeof(sql_queue_node));

   // set values
   record->victim = _strdup(victim);
   record->killer = _strdup(killer);
   record->room = _strdup(room);
   record->attack = _strdup(attack);
   record->ispvp = ispvp;

   // attach to node
   node->type = STAT_PLAYERDEATH;
   node->data = record;

   // try to enqueue
   enqueued = _MySQLEnqueue(node);

   // cleanup in case of fail
   if (!enqueued)
   {
      free(record->victim);
      free(record->killer);
      free(record->room);
      free(record->attack);

      free(record);
      free(node);
   }

   return enqueued;
};
Beispiel #8
0
BOOL MySQLRecordPlayerLogin(char* account, char* character, char* ip)
{
	BOOL					enqueued;	
	sql_record_playerlogin* record;
	sql_queue_node*			node;

	if (state == 0 || !account || !character || !ip)
		return FALSE;

	// allocate
	record	= (sql_record_playerlogin*)malloc(sizeof(sql_record_playerlogin));
	node	= (sql_queue_node*)malloc(sizeof(sql_queue_node));

	// set values
	record->account		= _strdup(account);
	record->character	= _strdup(character);
	record->ip			= _strdup(ip);
	
	// attach to node
	node->type = STAT_PLAYERLOGIN;
	node->data = record;

	// try to enqueue
	enqueued = _MySQLEnqueue(node);

	// cleanup in case of fail
	if (!enqueued)
	{
		free(record->account);
		free(record->character);
		free(record->ip);

		free(record);
		free(node);
	}
	
	return enqueued;
};
BOOL MySQLRecordGuild(char* name, char* leader, char* hall)
{
   BOOL							      enqueued;
   sql_record_guild*		         record;
   sql_queue_node*					node;

   if (state == 0 || !name || !leader || !hall)
      return FALSE;

   // allocate
   record = (sql_record_guild*)malloc(sizeof(sql_record_guild));
   node = (sql_queue_node*)malloc(sizeof(sql_queue_node));

   // set values
   record->name = _strdup(name);
   record->leader = _strdup(leader);
   record->hall = _strdup(hall);

   // attach to node
   node->type = STAT_GUILD;
   node->data = record;

   // try to enqueue
   enqueued = _MySQLEnqueue(node);

   // cleanup in case of fail
   if (!enqueued)
   {
      free(record->name);
      free(record->leader);
      free(record->hall);

      free(record);
      free(node);
   }

   return enqueued;
};