void CHorseNameManager::Validate(LPCHARACTER pChar) { CAffect *pkAff = pChar->FindAffect(AFFECT_HORSE_NAME); if ( pkAff != NULL ) { if ( pChar->GetQuestFlag("horse_name.valid_till") < get_global_time() ) { pChar->HorseSummon(false, true); pChar->RemoveAffect(pkAff); UpdateHorseName(pChar->GetPlayerID(), "", true); pChar->HorseSummon(true, true); } else { ++(pkAff->lDuration); } } }
int horse_set_name(lua_State* L) { // 리턴값 // 0 : 소유한 말이 없다 // 1 : 잘못된 이름이다 // 2 : 이름 바꾸기 성공 if ( lua_isstring(L, -1) != true ) return 0; LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr(); if ( ch->GetHorseLevel() > 0 ) { const char* pHorseName = lua_tostring(L, -1); if ( pHorseName == NULL || check_name(pHorseName) == 0 ) { lua_pushnumber(L, 1); } else { int nHorseNameDuration = test_server == true ? 60*5 : 60*60*24*30; ch->SetQuestFlag("horse_name.valid_till", get_global_time() + nHorseNameDuration); ch->AddAffect(AFFECT_HORSE_NAME, 0, 0, 0, PASSES_PER_SEC(nHorseNameDuration), 0, true); CHorseNameManager::instance().UpdateHorseName(ch->GetPlayerID(), lua_tostring(L, -1), true); ch->HorseSummon(false, true); ch->HorseSummon(true, true); lua_pushnumber(L, 2); } } else { lua_pushnumber(L, 0); } return 1; }
int horse_summon(lua_State* L) { LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr(); // 소환하면 멀리서부터 달려오는지 여부 bool bFromFar = lua_isboolean(L, 1) ? lua_toboolean(L, 1) : false; // 소환수의 vnum DWORD horseVnum= lua_isnumber(L, 2) ? lua_tonumber(L, 2) : 0; const char* name = lua_isstring(L, 3) ? lua_tostring(L, 3) : 0; ch->HorseSummon(true, bFromFar, horseVnum, name); return 0; }
int horse_unsummon(lua_State* L) { LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr(); ch->HorseSummon(false); return 0; }