Example #1
0
void Storage_LoadAdditionalTables()
{
    ExtraMapCreatureTables.insert(std::string("creature_spawns"));
    ExtraMapGameObjectTables.insert(std::string("gameobject_spawns"));

    std::string strData = Config.MainConfig.GetStringDefault("Startup", "LoadAdditionalTables", "");
    if (strData.empty())
        return;

    std::vector<std::string> strs = StrSplit(strData, ",");
    if (strs.empty())
        return;

    for (std::vector<std::string>::iterator itr = strs.begin(); itr != strs.end(); ++itr)
    {
        char s1[200];
        char s2[200];
        if (sscanf((*itr).c_str(), "%s %s", s1, s2) != 2)
            continue;

        if (LoadAdditionalTable(s2, s1, true))
        {
            std::pair<std::string, std::string> tmppair;
            tmppair.first = std::string(s1);
            tmppair.second = std::string(s2);
            additionalTables.push_back(tmppair);
        }
    }
}
Example #2
0
bool Storage_ReloadTable(const char* TableName)
{
    // bur: mah god this is ugly :P
    /*if (!stricmp(TableName, "items"))                    // Items
        ItemPrototypeStorage.Reload();
    else if (!stricmp(TableName, "creature_proto"))        // Creature Proto
        CreatureProtoStorage.Reload();
    else if (!stricmp(TableName, "creature_names"))        // Creature Names
        CreatureNameStorage.Reload();
    else if (!stricmp(TableName, "gameobject_names"))    // GO Names
        GameObjectNameStorage.Reload();*/
    if (!stricmp(TableName, "areatriggers"))        // Areatriggers
        AreaTriggerStorage.Reload();
    else if (!stricmp(TableName, "itempages"))            // Item Pages
        ItemPageStorage.Reload();
    else if (!stricmp(TableName, "npc_script_text"))            // Creature Text
        CreatureTextStorage.Reload();
    else if (!stricmp(TableName, "gossip_menu_option"))            // Gossip Menu Option
        GossipMenuOptionStorage.Reload();
    else if (!stricmp(TableName, "worldstring_tables"))            // wst
        WorldStringTableStorage.Reload();
    else if (!stricmp(TableName, "worldbroadcast"))            // wb
        WorldBroadCastStorage.Reload();
    else if (!stricmp(TableName, "npc_text"))            // NPC Text Storage
        NpcTextStorage.Reload();
    else if (!stricmp(TableName, "fishing"))                // Fishing Zones
        FishingZoneStorage.Reload();
    else if (!stricmp(TableName, "teleport_coords"))        // Teleport coords
        TeleportCoordStorage.Reload();
    else if (!stricmp(TableName, "graveyards"))            // Graveyards
        GraveyardStorage.Reload();
    else if (!stricmp(TableName, "worldmap_info"))        // WorldMapInfo
        WorldMapInfoStorage.Reload();
    else if (!stricmp(TableName, "zoneguards"))
        ZoneGuardStorage.Reload();
    else if (!stricmp(TableName, "command_overrides"))    // Command Overrides
    {
        CommandTableStorage::getSingleton().Dealloc();
        CommandTableStorage::getSingleton().Init();
        CommandTableStorage::getSingleton().Load();
    }
    else if (!stricmp(TableName, "points_of_interest"))
        PointOfInterestStorage.Reload();
    else if (!stricmp(TableName, "player_xp_for_level"))
        objmgr.LoadXpToLevelTable();
    else
        return false;

    uint32 len = (uint32)strlen(TableName);
    uint32 len2;
    for (std::vector<std::pair<std::string, std::string> >::iterator itr = additionalTables.begin(); itr != additionalTables.end(); ++itr)
    {
        len2 = (uint32)itr->second.length();
        if (!strnicmp(TableName, itr->second.c_str(), std::min(len, len2)))
            LoadAdditionalTable(TableName, itr->first.c_str());
    }
    return true;
}
Example #3
0
bool Storage_ReloadTable(const char * TableName)
{
	// bur: mah god this is ugly :P
	if(!stricmp(TableName, "items"))					// Items
		ItemPrototypeStorage.Reload();
	else if(!stricmp(TableName, "creature_proto"))		// Creature Proto
		CreatureProtoStorage.Reload();
	else if(!stricmp(TableName, "creature_names"))		// Creature Names
		CreatureNameStorage.Reload();
	else if(!stricmp(TableName, "gameobject_names"))	// GO Names
		GameObjectNameStorage.Reload();
	else if(!stricmp(TableName, "areatriggers"))		// Areatriggers
		AreaTriggerStorage.Reload();
	else if(!stricmp(TableName, "itempages"))			// Item Pages
		ItemPageStorage.Reload();
	else if(!stricmp(TableName, "worldstring_tables"))			// wst
		WorldStringTableStorage.Reload();
	else if(!stricmp(TableName, "worldbroadcast"))			// wb
		WorldBroadCastStorage.Reload();
	else if(!stricmp(TableName, "quests"))				// Quests
		QuestStorage.Reload();
	else if(!stricmp(TableName, "npc_text"))			// NPC Text Storage
		NpcTextStorage.Reload();
	else if(!stricmp(TableName, "fishing"))				// Fishing Zones
		FishingZoneStorage.Reload();
	else if(!stricmp(TableName, "teleport_coords"))		// Teleport coords
		TeleportCoordStorage.Reload();
	else if(!stricmp(TableName, "graveyards"))			// Graveyards
		GraveyardStorage.Reload();
	else if(!stricmp(TableName, "worldmap_info"))		// WorldMapInfo
		WorldMapInfoStorage.Reload();
	else if(!stricmp(TableName, "zoneguards"))
		ZoneGuardStorage.Reload();
	else if(!stricmp(TableName, "unit_display_sizes"))
		UnitModelSizeStorage.Reload();
	else if(!stricmp(TableName, "command_overrides"))	// Command Overrides
	{
		CommandTableStorage::getSingleton().Dealloc();
		CommandTableStorage::getSingleton().Init();
		CommandTableStorage::getSingleton().Load();
	}
	else
		return false;
	
	uint32 len = (uint32)strlen(TableName);
	uint32 len2;
	for(vector<pair<string,string> >::iterator itr = additionalTables.begin(); itr != additionalTables.end(); ++itr)
	{
		len2=(uint32)itr->second.length();
		if(!strnicmp(TableName, itr->second.c_str(), min(len,len2)))
			LoadAdditionalTable(TableName, itr->first.c_str());
	}
	return true;
}