Jump to content

Rinor

Community
  • Content Count

    551
  • Joined

  • Last visited

  • Days Won

    11

Everything posted by Rinor

  1. Also this still throwing same errors: https://imgur.com/a/kKO3xJa
  2. UiMinimapForm.h: namespace GUI { // 小地图 class CMiniMapMgr : public CUIInterface { public: CMiniMapMgr() : frmMinimap(0), MinimatRect(0), labMapPos(0), labMapName(0), frmBigmap(0){} // 用于小地图更新时得到Form大小 CCompent* GetMinimapRect() { return MinimatRect; } void RefreshChaPos( int x, int y ); void RefreshMapName (const char * name ); C3DCompent* GetBigmapRect() { return d3dBigmap; } bool IsShowBigmap(); CForm* GetBigmapForm() { return frmBigmap; } void ClearRadar(); void CloseRadar(); const char* GetMapName() { return labMapName->GetCaption(); } bool IsPKSilver(); bool IsGuildWar(); void ShowRadar(const char * szX,const char * szY);//add by alfred.shi 20080710 CLabelEx* GetLabMapPos(){return labMapPos;} protected: virtual bool Init(); virtual void End(); virtual void SwitchMap(); private: static void _MiniFormMouseEvent(CCompent *pSender, int nMsgType, int x, int y, DWORD dwKey); static void _RadarFormEvent(CCompent *pSender, int nMsgType, int x, int y, DWORD dwKey); static void _RenderBigmapEvent(C3DCompent *pSender, int x, int y); static void _evtShowbigmap(CGuiData *pSender); static void _evtHidebigmap(CGuiData *pSender); //雷达界面的enter事件 static void _evtRadarEnter(CGuiData *pSender); static void _RadarFormBeforeShowEvent(CForm* pForm, bool& IsShow); static void _evtShowNPCList(CGuiData *pSender,int x,int y ,DWORD key); static void _evtShowQueen(CGuiData *pSender,int x,int y ,DWORD key); static void _evtShowQQ(CGuiData *pSender,int x, int y, DWORD key ); static void _evtSearchQueen( CGuiData *pSender, int x, int y, DWORD key ); static void ShowRadar(); // 检查坐标输入框是否有非法字符(只支持整数) 正确返回0,其他的暂定为-1 static int CheckCoordinateEdit(const char* input); // 绘制大地图提示 void _RenderBigMapHint(void);//Add by sunny.sun 20080903 //小地图表单 CForm* frmMinimap; CCompent* MinimatRect; enum { MAP_POS_MAX = 10, }; //小地图控件 CLabelEx *labMapPosRand[MAP_POS_MAX]; CLabelEx *labMapPos; CLabelEx *labMapName; CTextButton *btnQueen; CTextButton *btnQQ; CTextButton *btnPosSearch; CTextButton *btnSeach; // 搜索女神 CCheckBox* chkID; CForm* frmBigmap; C3DCompent* d3dBigmap; static CForm* frmRadar; static CEdit* edtX; static CEdit* edtY; static CCombo* cboAddr; //CMPFont g_CFont; }; }
  3. Hello, I noticed an error when trying to use NPCInfo and MonsterList Info from original src code shared by vector to another src, both uses vs 2003 and somehow it works fine on the original one but throws some errors when copying it to another src. Heres the 2 errors from visual studio 2003: https://imgur.com/a/F7Pf6bs Here the codes of both codes, first error Npc CRawDataInfo: NPCHelper* NPCHelper::_Instance = NULL; BOOL NPCHelper::_ReadRawDataInfo(CRawDataInfo *pRawDataInfo, vector<basic_string> &ParamList) { if(ParamList.size()==0) return FALSE; NPCData *pInfo = (NPCData*)pRawDataInfo; int m = 0, n = 0; string strList[8]; string strLine; // npc显示名称 _tcsncpy(pInfo->szName, pInfo->szDataName, NPC_MAXSIZE_NAME); pInfo->szName[NPC_MAXSIZE_NAME - 1] = _TEXT('\0'); _tcsncpy(pInfo->szArea, ParamList[m++].c_str(), NPC_MAXSIZE_NAME); pInfo->szMapName[NPC_MAXSIZE_NAME - 1] = _TEXT('\0'); // npc位置信息 Util_ResolveTextLine( ParamList[m++].c_str(), strList, 8, ',' ); pInfo->dwxPos0 = Str2Int(strList[0]); pInfo->dwyPos0 = Str2Int(strList[1]); // npc所在地图显示名称 _tcsncpy(pInfo->szMapName, ParamList[m++].c_str(), NPC_MAXSIZE_NAME); pInfo->szMapName[NPC_MAXSIZE_NAME - 1] = _TEXT('\0'); return TRUE; } class NPCData : public CRawDataInfo { public: char szName[NPC_MAXSIZE_NAME]; // 地图中显示npc名称 char szArea[NPC_MAXSIZE_NAME]; // 位置或者等级 DWORD dwxPos0, dwyPos0; // npc位置信息 char szMapName[NPC_MAXSIZE_NAME]; // npc所在地图名称 }; class NPCHelper : public CRawDataSet { public: static NPCHelper* I() { return _Instance; } NPCHelper(int nIDStart, int nIDCnt, int nCol = 128) : CRawDataSet(nIDStart, nIDCnt, nCol) { _Instance = this; _Init(); } protected: static NPCHelper* _Instance; // 相当于单键, 把自己记住 virtual CRawDataInfo* _CreateRawDataArray(int nCnt) { return new NPCData[nCnt]; } virtual void _DeleteRawDataArray() { delete[] (NPCData*)_RawDataArray; } virtual int _GetRawDataInfoSize() { return sizeof(NPCData); } virtual void* _CreateNewRawData(CRawDataInfo *pInfo) { return NULL; } virtual void _DeleteRawData(CRawDataInfo *pInfo) { SAFE_DELETE(pInfo->pData); } virtual BOOL _ReadRawDataInfo(CRawDataInfo *pRawDataInfo, vector<string> &ParamList); }; inline NPCData* GetNPCDataInfo( int nTypeID ) { return (NPCData*)NPCHelper::I()->GetRawDataInfo(nTypeID); } and this is the 2nd code error, ShowRadar: void CMiniMapMgr::ShowRadar() { const char * szX = edtX->GetCaption(); const char * szY = edtY->GetCaption(); if (CHECK_FAILED(CheckCoordinateEdit(szX))) { g_pGameApp->MsgBox(g_oLangRec.GetString(720)); edtX->SetCaption(""); edtX->SetActive(edtX); return; } if (CHECK_FAILED(CheckCoordinateEdit(szY))) { g_pGameApp->MsgBox(g_oLangRec.GetString(720)); edtY->SetCaption(""); edtY->SetActive(edtY); return; } // 坐标; int x = atoi(szX), y = atoi(szY); D3DXVECTOR3 target((float)x, (float)y, 0); // 地点 const char* szAddress = cboAddr->GetText(); CWorldScene* pScene = dynamic_cast<CWorldScene*>(CGameApp::GetCurScene()); if( !pScene ) return; CNavigationBar::g_cNaviBar.SetTarget((char*)szAddress, target); CNavigationBar::g_cNaviBar.Show(true); frmRadar->Hide(); } void ShowRadar(const char * szX,const char * szY);//add by alfred.shi 20080710 static void ShowRadar(); void CStartMgr::_evtNPCListChange(CGuiData *pSender) { CListItems* pItems = g_stUIStart.lstCurrList->GetItems(); int nIndex = pItems->GetIndex(g_stUIStart.lstCurrList->GetSelectItem()); CItemRow* itemrow = g_stUIStart.lstCurrList->GetSelectItem(); CItemObj* itemobj = itemrow->GetBegin(); std::string itemstring(itemobj->GetString()); int pos = (int)itemstring.find(">") + 1; int pos1 = (int)itemstring.find("<",pos); int pos2 = (int)itemstring.find(",",pos); int pos3 = (int)itemstring.find(">",pos); if(pos1 >= 0 && pos2 > pos1 && pos3 > pos2 && pos3 <= (int)itemstring.length()) { string xStr = itemstring.substr(pos1 + 1,pos2 - pos1 - 1); string yStr = itemstring.substr(pos2 + 1,pos3 - pos2 - 1); g_stUIMap.ShowRadar(xStr.c_str(),yStr.c_str()); } g_stUIStart.ShowNPCHelper(g_stUIStart.GetCurrMapName(),false); } If anyone can give me a hand here, thank you!
  4. Fixed it, forgot to put the MindPower.dll that was generated when compiled the source, inside system folder. The main issue im having is the table bin files, i can't open the game cuz it says, "Unable to open iteminfo.bin" for example but it happens for all of the table folder .bin files. I also can't compile them using this client cuz it throws errors on compiler, but i can't even compile with another client and use the generated .bins cuz it will show the error i said above, "Unable to open iteminfo.bin" or characterinfo or all others. @V3ct0r Do you have any clue about this?
  5. So i managed to compile the Client without errors, and when i try to open the client it throws this error as shown on the photo below: https://imgur.com/a/NKuZf1I
  6. Hi @V3ct0r, i would like to ask if you could share the serverside exes and client that you use for this mods for yourself. Just wondering if you have the serverside exes that has some exploits and sql injections fixed that people use to crash server and get into host these old school exploits i don’t remember all (maybe people could share their ideas how they work, so you could contribute to fix) but which are still available on public exes, so we could use this mods of yours safely. Maybe some exes that could be a good for starting a server without many troubles of this kind of exploits. Not asking for myself only, i’m asking for all our community if thats possible by you. Thanks for the contribute and your hard work.
  7. I just added them both but it's throwing still the same errors EDIT: Fixed just had to replace ResStrings
  8. Hey everyone, i'm trying to make the public 1.3x source codes work, that are shared by @V3ct0r So far server-side source are compiled succesfully also managed to compile everything in client-side expect some issues with game.exe the issue im having with it is the ResString, somehow it won't read them anyone has any idea how to fix this one or what to look or where to look? the issues are thrown for every file of game.exe but i took a screenshot of one, below: https://imgur.com/a/omHART1 https://imgur.com/a/pOLLuRI
  9. Its used like that in top-recode so whats the difference? Still bad refactor? Lol
  10. bool CTableMapMask::GetColNameByMapName(const char *szMapName, char *szColName, long lColNameLen) { if (!szMapName || !szColName) return false; char *szColBase = "content"; if ((long)strlen(szColBase) + 1 >= lColNameLen) return false; char chIndex = 0; if (!strcmp(szMapName, "garner")) chIndex = 1; else if (!strcmp(szMapName, "magicsea")) chIndex = 2; else if (!strcmp(szMapName, "darkblue")) chIndex = 3; else if (!strcmp(szMapName, "winterland")) // Add by lark.li 20080812 chIndex = 4; //else if (!strcmp(szMapName, "eastgoaf")) // chIndex = 4; //else if (!strcmp(szMapName, "lonetower")) // chIndex = 5; else return false; _snprintf_s(szColName, sizeof(szColName), _TRUNCATE, "%s%d", szColBase, chIndex); return true; } bool CTableMapMask::ReadData(CPlayer *pCPly) { if(!pCPly || !pCPly->IsValid()) { //LG("enter_map", "读地图掩码数据库错误,角色不存在.\n"); LG("enter_map", "Load map hideID database error,character is inexistence.\n"); return false; } if (pCPly->GetMapMaskDBID() == 0) { long lDBID; if (!Create(lDBID, pCPly->GetDBChaId())) return false; pCPly->SetMapMaskDBID(lDBID); } char szMaskColName[30]; if (!GetColNameByMapName(pCPly->GetMaskMapName(), szMaskColName, 30)) { //LG("enter_map", "选择地图掩码数据错误.\n"); LG("enter_map", "choice map hideID data error.\n"); return false; } int nIndex = 0; char param[80]; _snprintf_s(param, sizeof(param), _TRUNCATE, "cha_id, %s", szMaskColName); char filter[80]; _snprintf_s(filter, sizeof(filter), _TRUNCATE, "id=%d", pCPly->GetMapMaskDBID()); int r = _get_row3(g_buf, g_cnCol, param, filter); int r1 = get_affected_rows(); if (DBOK(r) && r1 > 0) { DWORD dwChaId = Str2Int(g_buf[nIndex++]); if (dwChaId != pCPly->GetDBChaId()) { //LG("enter_map", "读地图掩码数据库错误,角色不匹配.\n"); LG("enter_map", "Load map hideID database error,character is not matching.\n"); return false; } pCPly->SetMapMaskBase64(g_buf[nIndex++].c_str()); //if (strcmp(g_buf[nIndex-1].c_str(), "0")) // LG("大地图长度", "地图 %s,长度 %u.\n", pCPly->GetMaskMapName(), strlen(g_buf[nIndex-1].c_str())); } else { //LG("enter_map", "读地图掩码数据库错误,_get_row()返回值:%d.%u\n", r); LG("enter_map", "Load map hideID database error,_get_row() return value:%d.%u\n", r); return false; } //LG("enter_map", "读大地图数据成功.\n"); LG("enter_map", "Load big map data succeed.\n"); return true; }
  11. Thanks for sharing this mod, i’d like to know if this one will include the http feature as it used to have on the one we used to buy from you, cuz i didn’t see it inside the configure file or on features list you mentioned above.
  12. Hm, based on the error that i get it throws error about column “con” inside the map_mask table, while theres no such column, there is just content1…content5 and the only code inside source code about this are the one i sent above, the one that mkhzaleh sent could be the fix maybe? I haven’t tested it yet. You have any other clue? Theres no other map_mask code inside source that is related to content1…content5 expect “content” only which is this one: char* szColBase = "content"; like mkhzaleh sent above.
  13. So sprintf cant be used like this but as you saying below?:
  14. It is content1...content5 already by default inside source codes of gameserver _snprintf_s(g_sql, sizeof(g_sql), _TRUNCATE, "select \ id, cha_id, content1, content2, content3, content4, content5 \ from %s \ (nolock) where 1=2", \ _get_table());
  15. Hi @V3ct0r, map_mask table has only this kind of column's https://imgur.com/a/ZGGc6YQ It has same columns on a clean DB aswell, i can't find any con column related inside source code which asks for this column con inside map_mask, do you have any idea of this issue?
  16. Hi, i went through gameserver logs on my test server (playing with CO src/files), i noticed something at util_db.txt file: [02-28 18:42:35]SQL Error State:42S22, Native Error Code: CF, ODBC Error: [Microsoft][ODBC SQL Server Driver][SQL Server]Invalid column name 'con'. [02-28 18:42:35][STMT:0x3238720][SQLERR]: [select cha_id, con from map_mask where id=2790] So i first checked database and the column name was con I tried to add con attribute ingame to check if it updates on database and it did I went through source code to check database if the column was con and it was Still it throws this error while other stuff as agi,sta etc.. are fine. Could anyone give me any clue on this? thanks
  17. The Code works fine, it even gives the Reward also the code gets deleted from the .dat files after the USE, it just for some reason throws that error at lua_err
  18. @V3ct0r Hi, that github link is not the repository of the mods, it is redirecting to the main page of github.
  19. I’m using CO GameServer, as this was just a lua script and co gs has a working handlechat.
  20. @V3ct0r i get this error: [02-20 16:37:45]DoString HandleChat [02-20 16:37:45]./resource/../lua/plugin/promocode.lua:42: attempt to call a table value Line 42 starts at: -- Write data for key, value in promo.list do
  21. Yo, i'm just asking cuz the mods you sharing are very useful, but i don't see it useful to use them on public exes as they are full exploits and theres no fixes for them, unless these was source-code, i think would be great to share fixes for exploits aswell so this mods can be used safely on public exes and we could use them for good. As we all know we'd be dealing with crashes/exploits when using the public exes and theres many already.
  22. Hey @V3ct0r just wondering since you sharing all this mods do you have Server-Side 1.38 exes that are stable? No exploits/crashes?
  23. I guess you did this for wpe? Cuz i have same logic but is just 3 lines of code, “if you meant that for wpe length that crashes gate”
  24. this is loaded inside birth_config.lua: CTF.CreateSpawn() this is loaded from Configuration.lua inside map folder CTF.Conf.MapName = "Capture The Flag" -- This is the overall map name, also displayed in notices/messages. CTF.Conf.NumMapCopy = 1 -- Number of map copies available, you must either edit ctrl.lua (v1.X) or MapCopyNum.txt (v2.X) to the same number. CTF.Conf.NumPlayer = 2 -- Number of players needed in lobby to start battle (by default: 50). CTF.Conf.MinLv = 45 -- Set a minimum level to be able to register. CTF.Conf.MaxLv = 100 -- Set a maximum level to be able to register. CTF.Conf.ServerLv = 100 -- Set the max level available in server, this is needed for EXP rewards. CTF.Conf.ServerVersion = 1 -- This is your server's version (v1.X = 1, v2.X = 2). If your server is v1.x and you put 1, it will automatically create the copies. If your server version is v2.x, put 2 and you have to manually adjust MapCopyNum.txt. CTF.Conf.MapType = 17 -- This is your map type, it should be different from any other maps you may have, be sure to check your maps or "is_friend" function to avoid duplicates. CTF.Conf.Flag = {ID = 75, Pos_X = 150, Pos_Y = 150, State = 199} CTF.Conf.FlagZone[1] = {245, 53} -- Coordinates of green team flag zone. CTF.Conf.FlagZone[2] = {48, 246} -- Coordinates of red team flag zone. CTF.Conf.ScorePlayer = 1 -- Amount of points team will get after killing a enemy (by default: 1). CTF.Conf.ChanceScore = .25 -- Percentage to player get points after killing a enemy (by default: 25%). CTF.Conf.ScoreBase = 1 -- Amount of points team will get after carries the flag to theirs base. CTF.Conf.ScoreEnemy = 2 -- Amount of points team will get after carries the flag to enemy base. CTF.Conf.ScoreLimit = 5 -- Minimum points the team needs to win battle (by default: 100). CTF.Conf.Time.Lobby = 300 -- Overall time to battle start if minimum player number in lobby did not reached (by default : 5 min). CTF.Conf.Time.Attempt = 120 -- Time in seconds that player have to return match if DC (by default: 2 min). CTF.Conf.Time.Map = 1200 -- Overall time duration of the battle (by default: 20 min). CTF.Conf.Time.Refresh = 180 -- Time (in seconds) to announce round and team score in system (by default: 3 min). CTF.Conf.Time.Close = 20 -- Time (in seconds) to close map when battle ends (by default: 20 sec). CTF.Conf.Time.StartShow = {1,2,3,4,5,6,7,8,9,10,20,30,45,60,120,180,240,280} CTF.Conf.OpenDay = {0,1,2,3,4,5,6} -- Set the days available to register for CTF (by default: all day). CTF.Conf.OpenHour = {16,17} -- Set the hours available to register for CTF (by default: 17:00). CTF.Conf.CloseMin = 37 -- That minute which where registration will be available, after that it will be closed. -- Balance for classes in map (Gems and equipment will make no difference). CTF.Conf.Balance[8] = {Max = {HP = 5570, SP = 155}, Attack = {Min = 332, Max = 428, Speed = 72}, Defense = 292, PhysicalResist = 28, HitRate = 146, Dodge = 142, Critical = 15, Recovery = {HP = 56, SP = 2}, MoveSpeed = 480} CTF.Conf.Balance[9] = {Max = {HP = 2858, SP = 155}, Attack = {Min = 352, Max = 387, Speed = 100}, Defense = 125, PhysicalResist = 25, HitRate = 151, Dodge = 181, Critical = 15, Recovery = {HP = 31, SP = 3}, MoveSpeed = 480} CTF.Conf.Balance[12] = {Max = {HP = 2811, SP = 155}, Attack = {Min = 398, Max = 525, Speed = 100}, Defense = 105, PhysicalResist = 25, HitRate = 185, Dodge = 161, Critical = 15, Recovery = {HP = 34, SP = 1}, MoveSpeed = 480} CTF.Conf.Balance[13] = {Max = {HP = 2953, SP = 1700}, Attack = {Min = 168, Max = 234, Speed = 72}, Defense = 118, PhysicalResist = 24, HitRate = 154, Dodge = 148, Critical = 15, Recovery = {HP = 42, SP = 19}, MoveSpeed = 480} CTF.Conf.Balance[14] = {Max = {HP = 3652, SP = 1341}, Attack = {Min = 168, Max = 234, Speed = 72}, Defense = 137, PhysicalResist = 24, HitRate = 154, Dodge = 147, Critical = 15, Recovery = {HP = 55, SP = 15}, MoveSpeed = 480} CTF.Conf.Balance[16] = {Max = {HP = 3707, SP = 1307}, Attack = {Min = 162, Max = 215, Speed = 77}, Defense = 139, PhysicalResist = 24, HitRate = 146, Dodge = 147, Critical = 15, Recovery = {HP = 52, SP = 16}, MoveSpeed = 480} -- This are the rewards given at the end of the match to the green team -- If values are set to "0", if will not prompt to give out that reward, including items. -- For "EXP", it's in percentage of player's current level. CTF.Rewards.Reputation = 0 CTF.Rewards.Gold = 20000 CTF.Rewards.Honor = 0 CTF.Rewards.EXP = 0 CTF.Rewards.Items[1] = {ID = 5707, Quantity = 1, Quality = 4} -- The Universe Purse CTF.Rewards.Items[2] = {ID = 0938, Quantity = 1, Quality = 4} -- Goddess's Favor CTF.Rewards.Items[3] = {ID = 3095, Quantity = 1, Quality = 4} -- Hi-Amplifier of Strive CTF.Rewards.Items[4] = {ID = 3097, Quantity = 1, Quality = 4} -- Hi-Amplifier of Luck CTF.Rewards.Items[5] = {ID = 0854, Quantity = 1, Quality = 4} -- Million Dollar Note CTF.Rewards.Items[6] = {ID = 5750, Quantity = 1, Quality = 101} -- Yellow Jade CTF.Rewards.Items[7] = {ID = 5751, Quantity = 1, Quality = 101} -- Red Jade CTF.Rewards.Items[8] = {ID = 5752, Quantity = 1, Quality = 101} -- Green Jade -- You can edit this if you are using a different map than the one that came with the files and modify the coordinates if you want different spawns. -- This also affects in the code if you aren't using the random spawn function. CTF.Spawns[1] = {Name = CTF.Conf.MapName, Map = "ctf", Spawn = "CTF Red Team", X = 43, Y = 243} CTF.Spawns[2] = {Name = CTF.Conf.MapName, Map = "ctf", Spawn = "CTF Green Team", X = 241, Y = 44} and this is function.lua which is inside map folder: -- DO NOT EDIT THIS, PERIOD. if CTF == nil then CTF = {} CTF.Conf = {} CTF.Conf.Time = {} CTF.Conf.FlagZone = {} CTF.Conf.Balance = {} CTF.Spawns = {} CTF.Rewards = {} CTF.Rewards.Items = {} end -- Calling those customizable variables. dofile(GetResPath("ctf/Configuration.lua")) function CTF.Init() CTF.Members = {} CTF.Flag = {} CTF.EnterLobby = {} -- Stores the data to players if they entered the Lobby. CTF.LeaveTime = {} -- Stores the time players have to enter map again after leave the battle. CTF.Lobby_Tick = CTF.Conf.Time.Lobby -- Lobby wait time before battle start if minimum player not reached. CTF.LobbyOpened = false -- Declares if the lobby is opened or not. CTF.MapOpened = false -- Declares if the battle has started or not. end CTF.Init() --[[ -- Required functions. function GetChaRespawnPoint(Player) local ret = "" if GetChaMapName(Player) == "CTF" then local SideID = GetChaSideID(Player) if (SideID == 1) then ret = CTF.Spawns[2].Spawn -- I'd assume that those are defined in your current lua file which lead to similiar declarations in your birth_conf.lua else ret = CTF.Spawns[1].Spawn end return ret end end ]] --Required functions. function GetChaRespawnPoint(role) local map_name = GetChaMapName(role) if (map_name == "ctf") then local side_id = GetChaSideID(role) if (side_id == 1) then return "CTF Red Team" elseif (side_id == 2) then return "CTF Green Team" end end return "" end AdjustTextSpace = AdjustTextSpace or function(Text, Spaces, End) local Count = math.floor((Spaces - string.len(Text)) * 0.5) local Message = "" for C = 1, Count, 1 do Message = Message.." " end Message = Message..Text Count = math.floor(Spaces - string.len(Message)) for C = 1, Count, 1 do Message = Message.." " end if End ~= nil then Message = Message..End end return Message end function StartPlayerCTF(Player) local TeamID = 0 local PID = GetPlayerID(GetChaPlayer(Player)) if (CTF.Players[PID] == nil) then if (CTF.GreenTeam.Counter == CTF.RedTeam.Counter) then TeamID = math.random(1,2) else if (CTF.GreenTeam.Counter > CTF.RedTeam.Counter) then TeamID = 1 else TeamID = 2 end end CTF.Players[PID] = { cha = Player, side_id = TeamID, entered = LUA_FALSE } else CTF.Players[PID].cha = Player CTF.Players[PID].side_id = CTF.Players[PID].side_id CTF.Players[PID].entered = LUA_FALSE TeamID = CTF.Players[PID].side_id end if (TeamID == 1) then CTF.RedTeam.Counter = CTF.RedTeam.Counter + 1 MoveCity(Player, CTF.Spawns[TeamID].Spawn) else CTF.GreenTeam.Counter = CTF.GreenTeam.Counter + 1 MoveCity(Player, CTF.Spawns[TeamID].Spawn) end end -- Carry the flag to enemy team function CarryTheFlag(Player) local MapCopy = GetChaMapCopy(Player) local PID = GetRoleID(Player) local Name = GetChaDefaultName(Player) local side_id = GetChaSideID(Player) local x,y = GetChaPos(Player) x = math.floor(x/100) y = math.floor(y/100) local red_base = 4 * math.abs(x - CTF.Conf.FlagZone[2][1]) + 4 * math.abs(y - CTF.Conf.FlagZone[2][2]) local green_base = 4 * math.abs(x - CTF.Conf.FlagZone[1][1]) + 4 * math.abs(y - CTF.Conf.FlagZone[1][2]) if (red_base <= 12) then if (side_id == 1) then CTF.Flag_ChaID = 0 CTF.GreenTeam.Score = CTF.GreenTeam.Score + CTF.Conf.ScoreEnemy RemoveState(Player, CTF.Conf.Flag.State) MapCopyNotice(MapCopy, "["..CTF.Conf.MapName.."]: "..Name..", from the Green Team succesfully carried the flag to Red Team Base and gets +"..CTF.Conf.ScoreEnemy.." points!") end end if (green_base <= 12) then if (side_id == 2) then CTF.Flag_ChaID = 0 CTF.RedTeam.Score = CTF.RedTeam.Score + CTF.Conf.ScoreEnemy RemoveState(Player, CTF.Conf.Flag.State) MapCopyNotice(MapCopy, "["..CTF.Conf.MapName.."]: "..Name..", from the Red Team succesfully carried the flag to Green Team Base and gets +"..CTF.Conf.ScoreEnemy.." point!") end end --[[if (red_base <= 12 or green_base <= 12) then CTF.Flag_ChaID = 0 RemoveState(Player, CTF.Conf.Flag.State) end--]] end -- Calculating custom balance for classes in map. CTF.MapBalance = function(Player) if (GetChaMapName(Player) == "ctf") then local Job = GetChaAttr(Player, ATTR_JOB) if (CTF.Conf.Balance[Job] ~= nil) then local mf_final = Mf_final(Player) local crt_final = Crt_final(Player) local hrec_final = Hrec_final(Player) local srec_final = Srec_final(Player) local adis_final = Adis_final(Player) SetCharaAttr(CTF.Conf.Balance[Job].Max.HP, Player, ATTR_MXHP) SetCharaAttr(CTF.Conf.Balance[Job].Max.SP, Player, ATTR_MXSP) SetCharaAttr(CTF.Conf.Balance[Job].Attack.Min, Player, ATTR_MNATK) SetCharaAttr(CTF.Conf.Balance[Job].Attack.Max, Player, ATTR_MXATK) SetCharaAttr(CTF.Conf.Balance[Job].Defense, Player, ATTR_DEF) SetCharaAttr(CTF.Conf.Balance[Job].PhysicalResist, Player, ATTR_PDEF) SetCharaAttr(CTF.Conf.Balance[Job].HitRate, Player, ATTR_HIT) SetCharaAttr(CTF.Conf.Balance[Job].Dodge, Player, ATTR_FLEE) SetCharaAttr(mf_final, Player, ATTR_MF) SetCharaAttr(crt_final, Player, ATTR_CRT) SetCharaAttr(hrec_final, Player, ATTR_HREC) SetCharaAttr(srec_final, Player, ATTR_SREC) SetCharaAttr(adis_final, Player, ATTR_ADIS) SetCharaAttr(CTF.Conf.Balance[Job].MoveSpeed, Player, ATTR_MSPD) SetCharaAttr(100000/CTF.Conf.Balance[Job].Attack.Speed, Player, ATTR_ASPD) end end end -- Checking if the player team is equal the function argument. CTF.CheckChaSide = function(Player, SideID) if (GetChaSideID(TurnToCha(Player)) == SideID) then return LUA_TRUE end return LUA_FALSE end -- Checking team score in map. CTF.DisplayInfo = function(Player) local Message = "" Message = AdjustTextSpace(">> Capture The Flag <<", 42, "_") Message = Message..AdjustTextSpace("Red Team Score: ", 16)..AdjustTextSpace(CTF.RedTeam.Score, 20, "_") Message = Message..AdjustTextSpace("Green Team Score: ", 16)..AdjustTextSpace(CTF.GreenTeam.Score, 16, "_") Message = Message..AdjustTextSpace("Battle ends in: ", 16)..AdjustTextSpace(toclock(CTF.BattleTime), 21, "_") HelpInfoX(Player, 0, Message) return LUA_TRUE end -- Call that on "is_friend" at functions.lua CTF.Friendly = function(ATKER, DEFER) local ATKER_Team = GetChaSideID(ATKER) local DEFER_Team = GetChaSideID(DEFER) if ATKER_Team == DEFER_Team then return 1 else return 0 end end -- Call that on "birth.lua" CTF.CreateSpawn = function() for a = 1, (table.getn(CTF.Spawns)), 1 do AddBirthPoint(CTF.Spawns[a].Name, CTF.Spawns[a].Map, CTF.Spawns[a].X, CTF.Spawns[a].Y) AddBirthPoint(CTF.Spawns[a].Spawn, CTF.Spawns[a].Map, CTF.Spawns[a].X, CTF.Spawns[a].Y) end end CTF.StartMap = function() CTF.Players = {} -- Stores the data for players in battle. CTF.GreenTeam = {} -- Stores the data for the Green Team. CTF.RedTeam = {} -- Stores the data for the Red Team. CTF.GreenTeam.Counter = 0 -- Stores the number of players in Green Team. CTF.RedTeam.Counter = 0 -- Stores the number of players in Red Team. CTF.GreenTeam.Score = 0 -- Stores the score of the Red Team. CTF.RedTeam.Score = 0 -- Stores the score of the Green Team. CTF.BattleTime = CTF.Conf.Time.Map -- Stores the time of whole battle duration. CTF.MapOpened = true -- Starts the battle. CTF.LobbyOpened = false -- Closes the lobby. CTF.WinnerTeam = nil -- Declares the team winner of battle. CTF.Flag_ChaID = 0 -- Declares the player who carries the flag. CTF.Flag_Spawned = 0 -- Declares if the flag has been spawned. CTF.MapShutdown = CTF.Conf.Time.Close end function CTF.PKM(Mob, Player) local MobMap = GetChaMapName(Mob) local MapName = GetChaMapName(Player) local ChaName = GetChaDefaultName(Player) local ChaID = GetRoleID(Player) if (MapName == "ctf" and MobMap == "ctf") then local MobID = GetChaTypeID(Mob) if (MobID == CTF.Conf.Flag.ID) then local SideID = GetChaSideID(Player) local MapCopy = GetChaMapCopy(Player) local x,y = GetChaPos(Player) x = math.floor(x/100) y = math.floor(y/100) if (SideID == 2) then MapCopyNotice(MapCopy, "["..CTF.Conf.MapName.."]: "..ChaName..", from the Red Team captured the Flag at ("..x..","..y..")!") else MapCopyNotice(MapCopy, "["..CTF.Conf.MapName.."]: "..ChaName..", from the Green Team captured the Flag at ("..x..","..y..")!") end CTF.Flag_ChaID = ChaID CTF.Flag_Spawned = 0 AddState(Player, Player, CTF.Conf.Flag.State, 1, 86400) end end end function CTF.PKP(ATKER, DEFER) local MapName_ATKER = GetChaMapName(ATKER) local MapName_DEFER = GetChaMapName(DEFER) if (MapName_ATKER == "ctf" and MapName_DEFER == "ctf") then local MapCopy = GetChaMapCopy(ATKER) local Name_ATKER = GetChaDefaultName(ATKER) local Name_DEFER = GetChaDefaultName(DEFER) local Side_ATKER = GetChaSideID(ATKER) local Side_DEFER = GetChaSideID(DEFER) local ChaID_ATKER = GetRoleID(ATKER) local ChaID_DEFER = GetRoleID(DEFER) if (Side_ATKER == 1) then Name_ATKER = Name_ATKER.." from the Green Team" -- Calculating the chance to grant points after kill enemy player if (Percentage_Random(CTF.Conf.ChanceScore) == 1) then CTF.GreenTeam.Score = CTF.Conf.ScorePlayer BickerNotice(ATKER, "Red Team enemy killed, your team gets +"..CTF.Conf.ScorePlayer.." point!") end else Name_ATKER = Name_ATKER.." from the Red Team" -- Calculating the chance to grant points after kill enemy player if (Percentage_Random(CTF.Conf.ChanceScore) == 1) then CTF.RedTeam.Score = CTF.Conf.ScorePlayer BickerNotice(ATKER, "Green Team enemy killed, your team gets +"..CTF.Conf.ScorePlayer.." point!") end end if (Side_DEFER == 1) then Name_DEFER = Name_DEFER.." from the Green Team" else Name_DEFER = Name_DEFER.." from the Red Team" end Notice("["..CTF.Conf.MapName.."]: "..Name_DEFER.." #03 was defeated by "..Name_ATKER.." #14 !") if (ChaID_DEFER == CTF.Flag_ChaID) then local x,y = GetChaPos(ATKER) x = math.floor(x/100) y = math.floor(y/100) if (Side_ATKER == 2) then MapCopyNotice(MapCopy, "["..CTF.Conf.MapName.."]: "..Name_ATKER.." captured the Flag at ("..x..", "..y..")!") else MapCopyNotice(MapCopy, "["..CTF.Conf.MapName.."]: "..Name_ATKER.." captured the Flag at ("..x..", "..y..")!") end CTF.Flag_ChaID = ChaID_ATKER RemoveState(DEFER, CTF.Conf.Flag.State) AddState(ATKER, ATKER, CTF.Conf.Flag.State, 1, 86400) end end end CTF.GiveRewards = function(Player, Reward) if Reward.Gold > 0 then AddMoney(Player, 0, Reward.Gold) end if Reward.Reputation > 0 then AddCreditX(Player, 0, Reward.Reputation) end if Reward.Honor > 0 and CheckBagItem(Player, 3849) == 1 then local Medal = GetChaItem2(Player, 2, 3849) local Honor = Reward.Honor + GetItemAttr(Medal, ITEMATTR_VAL_STR) SetItemAttr(Medal, ITEMATTR_VAL_STR, Honor) end if Reward.Items ~= nil then if GetChaFreeBagGridNum(Player) > 0 then local ItemID = Reward.Items[math.random(1,table.getn(Reward.Items))].ID local Quantity = Reward.Items[math.random(1,table.getn(Reward.Items))].Quantity local Quality = Reward.Items[math.random(1,table.getn(Reward.Items))].Quality GiveItem(Player, 0, ItemID, Quantity, Quality) BickerNotice(Player, "["..CTF.Conf.MapName.."]: Your team wins! Received x"..Quantity.." "..GetItemName(ItemID)..".") else GiveItemX(Player, 0, ItemID, Quantity, Quality) BickerNotice(Player, "["..CTF.Conf.MapName.."]: Your team wins! Received x"..Quantity.." "..GetItemName(ItemID)..".") end end local Level = Lv(Player) if Reward.EXP > 0 and Level < CTF.Conf.ServerLv then local CurrentEXP = GetChaAttr(Player, ATTR_CEXP) + ((DEXP[Level+1] - DEXP[Level]) * (Reward.EXP/100)) SetChaAttrI(Player, ATTR_CEXP, CurrentEXP) end end CTF.Finish = function(MapCopy) if CTF.MapShutdown > 0 then for i = 1, table.getn(CTF.Conf.Time.StartShow) do if CTF.MapShutdown == CTF.Conf.Time.StartShow[i] then MapCopyNotice(MapCopy, "["..CTF.Conf.MapName.."]: Battle has come to an end! All players will leave in "..CTF.MapShutdown.." seconds!") end end CTF.MapShutdown = CTF.MapShutdown - 1 if CTF.MapShutdown == 0 then if CTF.GreenTeam.Score > CTF.RedTeam.Score then CTF.WinnerTeam = 1 MapCopyNotice(MapCopy, "["..CTF.Conf.MapName.."]: The Green Team wins the battle with ("..CTF.GreenTeam.Score.."/"..CTF.Conf.ScoreLimit..") points!") GMNotice("["..CTF.Conf.MapName.."]: The Green Team wins the battle with ("..CTF.GreenTeam.Score.."/"..CTF.Conf.ScoreLimit..") points!") elseif CTF.RedTeam.Score > CTF.GreenTeam.Score then CTF.WinnerTeam = 2 MapCopyNotice(MapCopy, "["..CTF.Conf.MapName.."]: The Red Team wins the battle with ("..CTF.RedTeam.Score.."/"..CTF.Conf.ScoreLimit..") points!") GMNotice("["..CTF.Conf.MapName.."]: The Red Team wins the battle with ("..CTF.RedTeam.Score.."/"..CTF.Conf.ScoreLimit..") points!") else MapCopyNotice(MapCopy, "["..CTF.Conf.MapName.."]: It seems there was no winners at this match!") GMNotice("["..CTF.Conf.MapName.."]: It seems there was no winners at this match!") end local PlayerNum = GetMapCopyPlayerNum(MapCopy) BeginGetMapCopyPlayerCha(MapCopy) for i = 1, PlayerNum, 1 do local Player = GetMapCopyNextPlayerCha(MapCopy) if (ValidCha(Player) == 1) then local SideID = GetChaSideID(Player) if CTF.WinnerTeam ~= nil and SideID == CTF.WinnerTeam then CTF.GiveRewards(Player, CTF.Rewards) end end end DealAllActivePlayerInMap(MapCopy, "TakeOutSideCTF") CTF.Init() -- Reloads the map variables. ClearAllSubMapMonster(MapCopy) CloseMapCopy("ctf") return end end end TakeOutSideCTF = function(Player) MoveCity(Player, "") end CTF.OpenDay = function() local RegOpen = {Day = {}, Hour = {}} for i,v in pairs(CTF.Conf.OpenDay) do RegOpen.Day[v] = true end if (RegOpen.Day[tonumber(os.date("%w"))] == true) then return 1 end return 0 end CTF.OpenHour = function() local RegOpen = {Day = {}, Hour = {}} for i,v in pairs(CTF.Conf.OpenHour) do RegOpen.Hour[v] = true end if (RegOpen.Hour[tonumber(os.date("%H"))] == true) then return 1 end return 0 end CTF.Register = function(Player) local Minute = tonumber(os.date("%M")) local PID = GetRoleID(Player) local OsTime = os.time() local Attempt = CTF.LeaveTime[PID] if GetChaAttr(Player, ATTR_JOB) < 8 then BickerNotice(Player, "Only characters that have done 2nd class advancement can participate!") return end if CTF.OpenDay() == 0 then BickerNotice(Player, "Registering for "..CTF.Conf.MapName.." is unavailable today, please come back again tommorow.") return end if CTF.OpenHour() == 0 and Minute > CTF.Conf.CloseMin then BickerNotice(Player, "Registering for "..CTF.Conf.MapName.." is unavailable at this hour, please come back later.") return end -- Not registered and battle arealdy started. if CTF.Members[PID] == nil and CTF.MapOpened == true then BickerNotice(Player, "You can't participate, the battle arealdy started!") return end -- Registered, battle started and didn't DC on map. if CTF.Members[PID] ~= nil and CTF.Members[PID].lobby == 1 and CTF.MapOpened == true and Attempt == nil then StartPlayerCTF(Player) return end -- Registered, battle started and disconnect attempt time didn't gone. if CTF.Members[PID] ~= nil and CTF.Members[PID].lobby == 1 and CTF.MapOpened == true and Attempt ~= nil and OsTime < Attempt then StartPlayerCTF(Player) return end -- Registered, battle started and disconnect attempt time gone. if CTF.Members[PID] ~= nil and CTF.Members[PID].lobby == 1 and CTF.MapOpened == true and Attempt ~= nil and OsTime >= Attempt then BickerNotice(Player, "You can't participate anymore, your attempt time has gone!") return end if IsInTeam(Player) == 1 then BickerNotice(Player, "You're inside a party. Cannot register!") return end if CTF.Conf.MinLv > GetChaAttr(Player, ATTR_LV) or (CTF.Conf.MaxLv ~= 0 and CTF.Conf.MaxLv < GetChaAttr(Player, ATTR_LV)) then BickerNotice(Player, "You can't participate, only players between levels "..CTF.Conf.MinLv.." through "..CTF.Conf.MaxLv.." can participate.") return end CTF.Members[PID] = {role = Player, lobby = 1} MoveCity(Player, "Arena Island") end function CTF.Timer(Player, Tick) local Hour,Minute,Second = tonumber(os.date("%H")),tonumber(os.date("%M")),tonumber(os.date("%S")) local Message = "" for i,v in pairs(CTF.Conf.OpenHour) do if Hour == v and Minute < CTF.Conf.CloseMin then if (CTF.LobbyOpened == false) then CTF.LobbyOpened = true end end if Hour == v and Minute == 00 and Second == 05 then if (CTF.LobbyOpened == true) then Message = Message.."["..CTF.Conf.MapName.."]: Registration is now Open!" Message = Message.." Go to CTF Waiting Room - (2217,2792) Argent City." Message = Message.." You have 5 minute(s) to register for battle.." ScrollNotice(Message, 1) end end if Hour == v and Minute == 02 and Second == 05 then if (CTF.LobbyOpened == true) then Message = Message.."["..CTF.Conf.MapName.."]: Registration is now Open!" Message = Message.." Go to CTF Waiting Room - (2217,2792) Argent City." Message = Message.." You have 3 minute(s) to register for battle.." ScrollNotice(Message, 1) end end if Hour == v and Minute == 04 and Second == 05 then if (CTF.LobbyOpened == true) then Message = Message.."["..CTF.Conf.MapName.."]: Registration is now Open!" Message = Message.." Go to CTF Waiting Room - (2217,2792) Argent City." Message = Message.." You have 1 minute(s) to register for battle.." ScrollNotice(Message, 1) end end if Hour == v and Minute == CTF.Conf.CloseMin and Second == 00 then if (CTF.LobbyOpened == true) then CTF.LobbyOpened = false CTF.StartMap() GMNotice("["..CTF.Conf.MapName.."]: Map started! Red Team Versus Green Team. The team that get 100 point(s) first wins! Teams can get point(s) killing enemies (25% chance) or carry the Flag to Flag Pointer. After the team carries the flag to flag pointer, the flag holder will appear in the middle of the capture the flag. ***** If you are using Skill Tweak you can not see Flag Monster.") for i,v in pairs(CTF.Members) do if (GetChaMapName(v.role) == "pkmap") then StartPlayerCTF(v.role) end end end end end end function State_None_Add(role, statelv) end function State_None_Rem(role, statelv) end
  25. Then you wont be able to use this files as they have bunch of crashes/issues like if you fix this one there will be another and then another, so its better if you use sources for it.
×
×
  • Create New...