How To Implement New Maps - Custom Positions
Code:var[0].SetNumber(ginfo.gameServerId);var[1].SetString(ginfo.name);var[2].SetString("GAMEWORLD");switch (ginfo.mapId){case GBGameInfo::MAPID_WZ_Colorado:var[3].SetString("COLORADO");break;case GBGameInfo::MAPID_WZ_Cliffside:var[3].SetString("CLIFFSIDE");break;default:var[3].SetString("DEVMAP");break;}Main_Network.cppCode:switch(gClientLogic().m_gameInfo.mapId){default:r3dError("invalid map id\n");case GBGameInfo::MAPID_Editor_Particles:r3dGameLevel::SetHomeDir("WorkInProgress\\Editor_Particles");break;case GBGameInfo::MAPID_ServerTest:r3dGameLevel::SetHomeDir("WorkInProgress\\ServerTest");break;case GBGameInfo::MAPID_WZ_Colorado:r3dGameLevel::SetHomeDir("WZ_Colorado");break;case GBGameInfo::MAPID_WZ_Cliffside:r3dGameLevel::SetHomeDir("WZ_Cliffside");break;}UserProfile.cppCode:w.GamePos = r3dPoint3D(0, 0, 0);if (w.GameMapId == 3)//for Cliffsidesscanf(xmlItem.attribute("GamePos2").value(), "%f %f %f %f", &w.GamePos.x, &w.GamePos.y, &w.GamePos.z, &w.GameDir);else if (w.GameMapId == 4)//for ServerTestsscanf(xmlItem.attribute("GamePos3").value(), "%f %f %f %f", &w.GamePos.x, &w.GamePos.y, &w.GamePos.z, &w.GameDir);elsesscanf(xmlItem.attribute("GamePos").value(), "%f %f %f %f", &w.GamePos.x, &w.GamePos.y, &w.GamePos.z, &w.GameDir);Now for the server:MasterServerConfig.cppCode:static int StringToGBMapID(char* str){if(stricmp(str, "MAPID_WZ_Colorado") == 0)return GBGameInfo::MAPID_WZ_Colorado;if(stricmp(str, "MAPID_WZ_Cliffside") == 0)return GBGameInfo::MAPID_WZ_Cliffside;if(stricmp(str, "MAPID_Editor_Particles") == 0)return GBGameInfo::MAPID_Editor_Particles;if(stricmp(str, "MAPID_ServerTest") == 0)return GBGameInfo::MAPID_ServerTest;r3dError("bad GBMapID %s\n", str);return 0;}ServerGame.cppCode:switch(gServerLogic.ginfo_.mapId){default:r3dError("invalid map id\n");break;case GBGameInfo::MAPID_Editor_Particles:r3dGameLevel::SetHomeDir("WorkInProgress\\Editor_Particles");break;case GBGameInfo::MAPID_ServerTest:r3dGameLevel::SetHomeDir("WorkInProgress\\ServerTest");break;case GBGameInfo::MAPID_WZ_Colorado:r3dGameLevel::SetHomeDir("WZ_Colorado");break;case GBGameInfo::MAPID_WZ_Cliffside:r3dGameLevel::SetHomeDir("WZ_Cliffside");break;}NetPacketsGameInfo.hCode:enum EMapId{MAPID_Editor_Particles = 0,MAPID_ServerTest = 4,MAPID_WZ_Colorado = 2,MAPID_WZ_Cliffside = 3,// NOTE: do *NOT* add maps inside current IDs, add ONLY at the end// otherwise current map statistics in DB will be brokenMAPID_MAX_ID,};AsyncFuncs.cppCode:CWOBackendReq req("api_SrvCharUpdate.aspx");req.AddSessionInfo(CustomerID, SessionID);req.AddParam("map", slot.GameMapId);req.AddParam("skey1", g_ServerApiKey);req.AddParam("CharID", slot.LoadoutID);api_SrvCharUpdate.aspx.csCode:sqcmd.CommandText = "WZ_Char_SRV_SetStatus";sqcmd.Parameters.AddWithValue("@in_CustomerID", CustomerID);sqcmd.Parameters.AddWithValue("@in_MapID", web.Param("map"));sqcmd.Parameters.AddWithValue("@in_CharID", CharID);api_GetProfile1.aspx.csCode:xml.Append(xml_attr("XP", reader["XP"]));xml.Append(xml_attr("TimePlayed", reader["TimePlayed"]));xml.Append(xml_attr("GameMapId", reader["GameMapId"]));// Already addedxml.Append(xml_attr("GameServerId", reader["GameServerId"]));xml.Append(xml_attr("GamePos", reader["GamePos"]));xml.Append(xml_attr("GamePos2", reader["GamePos2"]));xml.Append(xml_attr("GamePos3", reader["GamePos3"]));xml.Append(xml_attr("GameFlags", reader["GameFlags"]));xml.Append(xml_attr("Health", reader["Health"]));- You finish with the Client and Game ServNow for the database part:- Add 2 new columns GamePos2, GamePos3 in table UsersCharsStore procedure: WarZ.dbo.WZ_Char_SRV_SetStatusCode:ALTER PROCEDURE [dbo].[WZ_Char_SRV_SetStatus]@in_CustomerID int,@in_MapID int,@in_CharID int,and belowCode:if @in_MapID = 3update UsersChars setGamePos2=@in_GamePos,GameFlags=@in_GameFlags,Alive=@in_Alive,Health=@in_Health,Food=@in_Hunger,Water=@in_Thirst,Toxic=@in_Toxic,TimePlayed=@in_TimePlayed,LastUpdateDate=GETDATE(),XP=@in_XP,Reputation=@in_Reputation,Stat00=@in_Stat00,Stat01=@in_Stat01,Stat02=@in_Stat02,Stat03=@in_Stat03,Stat04=@in_Stat04,Stat05=@in_Stat05where CharID=@in_CharIDelse if @in_MapID = 4update UsersChars setGamePos3=@in_GamePos,GameFlags=@in_GameFlags,Alive=@in_Alive,Health=@in_Health,Food=@in_Hunger,Water=@in_Thirst,Toxic=@in_Toxic,TimePlayed=@in_TimePlayed,LastUpdateDate=GETDATE(),XP=@in_XP,Reputation=@in_Reputation,Stat00=@in_Stat00,Stat01=@in_Stat01,Stat02=@in_Stat02,Stat03=@in_Stat03,Stat04=@in_Stat04,Stat05=@in_Stat05where CharID=@in_CharIDelseupdate UsersChars setGamePos=@in_GamePos,GameFlags=@in_GameFlags,Alive=@in_Alive,Health=@in_Health,Food=@in_Hunger,Water=@in_Thirst,Toxic=@in_Toxic,TimePlayed=@in_TimePlayed,LastUpdateDate=GETDATE(),XP=@in_XP,Reputation=@in_Reputation,Stat00=@in_Stat00,Stat01=@in_Stat01,Stat02=@in_Stat02,Stat03=@in_Stat03,Stat04=@in_Stat04,Stat05=@in_Stat05where CharID=@in_CharID