Level 120 (L1-L5): exp curve, AVA2 maps/drops, AVA2 dungeon quest support
- L1: level cap 120 with the AVA2 exp curve, 64-bit exp sums, unsigned exp column; level-difference exp/drop floors kept as before. - L2/L3/L5: AVA2 maps and their mob drops (data side in the client repo's tools/server/ava2-maps). - L4: quest functions the AVA2 snow / ship defence / Meley quests call (port_ava2_dungeon.cpp), QUEST_ATTACK_EVENT (<vnum>.attack), Meley and hydra HP helpers. A hit never takes a dragon statue (6230) below 1 HP so only npc.dead_by_vnum kills it (AVA2 could leave the lair stuck). - docs/FEATURE-LEVEL-120.md: plan and sbtest test record (Meley full run passed: 9 floors + chest + exit warp, 837 s). Only installed on sbtest; not deployed live. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
3222614dd2
commit
3c0141d639
@@ -0,0 +1,44 @@
|
||||
# Level cap 120 + AVA2 105–120 content
|
||||
|
||||
The user decided on 2026-10-16:
|
||||
- raise the level cap from 105 to 120;
|
||||
- for 105–119, use a geometric exp curve that stays under the DWORD limit;
|
||||
- keep the level-delta exp/drop table (`aiPercentByDeltaLev*`) unchanged;
|
||||
- port AVA2's new maps and dungeons, with drops for their monsters.
|
||||
|
||||
## Why the cap alone is not enough
|
||||
|
||||
- **Exp curve.** On the newcibn locale `exp_table` = `exp_table_common`. Its 105–119 entries only moved from 2.33e9 to 2.49e9, so every level cost about the same as 104. AVA2 climbs to 2.05e10, but its table is DWORD, so from 107 on it wraps: 4.37e9 becomes about 7.5e7. That is not copied.
|
||||
- **No monsters.** On 203 the highest normal monster that spawns is level 103 (6006); bosses and stones top out at 105. `PERCENT_LVDELTA` applies to exp, drop chance and gold alike. A player 12 levels above the monster gets 20%, and 15 or more levels above gets 1%. So without new monsters, 105–120 cannot be levelled.
|
||||
- **AVA2 has the content.** 445 monster/stone vnums are AVA2-only, and 348 of them are level 100 or higher. AVA2 also re-levels 47 shared monsters, for example 2493 from 97 to 105 and 3091 from 105 to 115.
|
||||
|
||||
## Phases
|
||||
|
||||
| | What | Where |
|
||||
|---|---|---|
|
||||
| L1 | `MAX_LEVEL: 120`; exp table 105–119 = 2.33e9 → 4.2e9 geometric (constants.cpp); `player.exp` / `player_deleted.exp` → `INT UNSIGNED`. Points are already DWORD on the server, and the client reads exp unsigned. | server, `tools/server/level-120` (client repo) |
|
||||
| L2 | Monsters: AVA2-only rows from AVA2 `db/mob_proto.txt` (not `share/conf`, which is an older copy), zh names, client mob models/motions (Monster, Monster2, NPC2 packs), `npclist`. | server proto + client pack |
|
||||
| L3 | Maps, 100+ first: `plechito_desert_map_01` (101–115), `metin2_map_elemental_04_rework` (103–112), Yohara `eastplain_01–03` + `empirecastle` (85–125), `metin2_map_dawnmist_dungeon_01` (120). Server map dir + index + MAP_ALLOW on a core; client map pack, atlas, minimap, zh map names; reach them through the travel ring / NPC like AVA2's `anillotp` / `tp_npc1`. | both |
|
||||
| L4 | Dungeons: `flame` (107–120, our 351 retuned), `snow` (`n_snow_dungeon_01` 352, 100–120), `meleylair` (212, 113–123, level ≥ 110), `shipdefense` (`defensawe_hydra` 355, 100–120). They need quest functions we lack: `d.global_warp_all_to_base`, `d.mission_notice`, `d.track_update`, `d.spawn_mob_new`, `d.new_kill_all`, `game.check_event`, `npc.set_meley_hp`, `npc.set_protect_flag2`, `npc.set_protect_time`, `npc.get_protect_time`, `npc.set_statu_affect`, `npc.set_statu_clear_aff`, `npc.show_statu`, `npc.dead_by_vnum`. AVA2's `when X.chat.lc_quest("…")` and `lc_quest` strings must become zh literals for our qc. | both |
|
||||
| L5 | Drops: AVA2 gives only 8 of the new monsters drops (203 already has those groups), so the rest are designed in the client repo's `tools/server/ava2-maps/drops_maps.tsv` (tiers normal / elite / boss / stone / gold, plus per-map and per-vnum-range rows) and written by `make_drops_maps.py`. Every drop item must exist in item_proto first, otherwise the core won't boot. | server |
|
||||
| L6 | Test on the sbtest cluster, then deploy with the rest of feature/ava2-unlock (needs approval). | 203 |
|
||||
|
||||
Later, below 105 or separate systems: summer maps `a1/c1_summer`, `metin2_12zi_stage` (zodiac, C++), `kingdoomswar`, `battlefied`. The plechi dungeons (slime/duratus/gold/nightmare/troll/elephant) have maps but no quest in AVA2's quest_list, so they are skipped.
|
||||
|
||||
## Open
|
||||
|
||||
- Whether to take AVA2's new levels for the 47 shared monsters.
|
||||
- Which 203 core carries the new maps. The cores are i386 and each uses about 400 MB.
|
||||
|
||||
## Status
|
||||
|
||||
- L1 done on sbtest (2026-10-16). Exp table 106–120 in constants.cpp. The exp sum in `CHARACTER::PointChange(POINT_EXP)` is now 64-bit, as are the death exp-loss product (char_battle.cpp) and the quest reward check (questpc.cpp). Before that fix, 3.67e9 + 2e9 at level 119 wrapped to 1375032704. Tested with `/set exp` on [SA]Admin:
|
||||
- 105 → 106 at 2.33e9;
|
||||
- 3375032704 (> 2^31) saved to `player_sb.player` and survived `restart.sh`;
|
||||
- +2e9 at 119 → 120;
|
||||
- no more gain at 120.
|
||||
The live schema change and live `MAX_LEVEL: 120` are not applied.
|
||||
- L2/L3 on sbtest (2026-10-17): the 10 maps of `tools/server/ava2-maps/README.md` (client repo) are installed in channel5's own locale/data farm (`sbtest_locale.sh`) and reachable with `/warp x y` (global metres; `/goto #index` does not reach them). Hydra is moved from AVA2's 972800,153600 to 3276800,0, so AVA2 quest coordinates shift by (+2304000, −153600); its entry is `/warp 33089 116`. Mob models render.
|
||||
- Client fix found on the way: after `/warp`, a timer chat (`/bio status`, `/server_bonuses`) sent between the new socket coming online and the core's GC_PHASE reached the core's handshake phase and got the connection closed ("Handshake phase does not handle packet 3"). The client now leaves the "Game" phase on GC_WARP and drops chat outside it.
|
||||
- L5 on sbtest (2026-10-17): 99 drop groups appended (107 generated, the 8 existing kept). A kill test on plechito (`/m` + `/weaken all` + auto hunt) dropped the tier items, the lv115 armor, and the flame/hydra boss materials.
|
||||
- L4 on sbtest (2026-10-17): AVA2's snow / ship defence / Meley quests ported as `snow_dungeon`, `ShipDefense`, `MeleyDungeon` by the client repo's `tools/server/ava2-dungeons` (`make_quests.py` + `install.sh`, see its README). Server side: `port_ava2_dungeon.cpp` (the `d.*` / `npc.*` functions AVA2's quests call), `QUEST_ATTACK_EVENT` (`<vnum>.attack`, Meley's HP phases), the Meley and hydra HP helpers. `d.track_update`, `game.check_event` and the battle pass calls were dropped from the quests instead of ported. The game build is installed only as sbtest's `game.switchbot` (previous one kept as `game.switchbot.pre-l4`). Entry test on the Mac client (key + `/warp` to the NPC + quest dialog → solo → yes): all three dungeons warp in (352, 355, 212), the key is used, the dungeon timers and mob spawns start, and syserr shows no quest errors. Meley full run (2026-10-17, solo GM at level 120 with a temporary sbtest-only damage/HP buff quest, since removed): all 9 floors, the floor-10 chest, and the exit warp back to map 62 (5986,6573) in 837 s; the 3 h cooldown flag is written. Fixes found on the way: `char_battle.cpp` never lets a hit take a dragon statue (6230) below 1 HP, so only the quest's `npc.dead_by_vnum` kills it (AVA2 has the same stuck-lair bug on floor 8); the client's autohunt now skips a target that is hit but takes no damage for 4 s (it stays skipped for 60 s). The client's `mt_dungeon_timer` shows the AVA2 dungeon timer (boss portrait, floor/wave, countdown) in place of the minimap, plus the hydra mast HP bar. Not yet played through: the snow floors, the hydra waves, party entry.
|
||||
@@ -61,7 +61,7 @@ CPPFILE = BattleArena.cpp FSM.cpp MarkConvert.cpp MarkImage.cpp MarkManager.cpp
|
||||
desc_client.cpp desc_manager.cpp desc_p2p.cpp dev_log.cpp dungeon.cpp empire_text_convert.cpp entity.cpp\
|
||||
entity_view.cpp event.cpp event_queue.cpp exchange.cpp file_loader.cpp fishing.cpp gm.cpp guild.cpp\
|
||||
guild_manager.cpp guild_war.cpp horse_rider.cpp horsename_manager.cpp input.cpp input_auth.cpp input_db.cpp\
|
||||
input_login.cpp input_main.cpp input_p2p.cpp port_boss_track.cpp port_attr_lock.cpp port_sash.cpp port_mount.cpp port_costume_attr.cpp port_pendant.cpp port_rings.cpp port_switchbot.cpp input_teen.cpp input_udp.cpp ip_ban.cpp\
|
||||
input_login.cpp input_main.cpp input_p2p.cpp port_boss_track.cpp port_attr_lock.cpp port_sash.cpp port_mount.cpp port_costume_attr.cpp port_pendant.cpp port_rings.cpp port_switchbot.cpp port_ava2_dungeon.cpp input_teen.cpp input_udp.cpp ip_ban.cpp\
|
||||
item.cpp item_addon.cpp item_attribute.cpp item_manager.cpp item_manager_idrange.cpp locale.cpp\
|
||||
locale_service.cpp log.cpp login_data.cpp lzo_manager.cpp marriage.cpp matrix_card.cpp\
|
||||
messenger_manager.cpp mining.cpp mob_manager.cpp monarch.cpp motion.cpp over9refine.cpp p2p.cpp packet_info.cpp\
|
||||
|
||||
@@ -267,6 +267,8 @@ void CHARACTER::Initialize()
|
||||
m_bPKMode = PK_MODE_PEACE;
|
||||
|
||||
m_dwQuestNPCVID = 0;
|
||||
m_dwQuestNPCVIDAttack = 0;
|
||||
m_protection_Time.clear();
|
||||
m_dwQuestByVnum = 0;
|
||||
m_pQuestItem = NULL;
|
||||
|
||||
@@ -3142,9 +3144,11 @@ void CHARACTER::PointChange(BYTE type, int amount, bool bAmount, bool bBroadcast
|
||||
DWORD iExpBalance = 0;
|
||||
|
||||
// 레벨 업!
|
||||
if (exp + amount >= next_exp)
|
||||
// PORT: 64-bit sum; with next_exp up to 4.2e9 (docs/FEATURE-LEVEL-120.md) exp + amount wraps a DWORD
|
||||
const unsigned long long total = (unsigned long long) exp + (unsigned long long) amount;
|
||||
if (total >= next_exp)
|
||||
{
|
||||
iExpBalance = (exp + amount) - next_exp;
|
||||
iExpBalance = (DWORD) (total - next_exp);
|
||||
amount = next_exp - exp;
|
||||
|
||||
SetExp(0);
|
||||
@@ -3152,7 +3156,7 @@ void CHARACTER::PointChange(BYTE type, int amount, bool bAmount, bool bBroadcast
|
||||
}
|
||||
else
|
||||
{
|
||||
SetExp(exp + amount);
|
||||
SetExp((DWORD) total);
|
||||
exp = GetExp();
|
||||
}
|
||||
|
||||
@@ -6172,6 +6176,36 @@ LPCHARACTER CHARACTER::GetQuestNPC() const
|
||||
return CHARACTER_MANAGER::instance().Find(m_dwQuestNPCVID);
|
||||
}
|
||||
|
||||
// PORT: AVA2 ENABLE_MELEY_LAIR_DUNGEON
|
||||
LPCHARACTER CHARACTER::GetQuestNPCAttack() const
|
||||
{
|
||||
return CHARACTER_MANAGER::instance().Find(m_dwQuestNPCVIDAttack);
|
||||
}
|
||||
|
||||
void CHARACTER::SetProtectTime(const std::string& flagname, int value)
|
||||
{
|
||||
m_protection_Time[flagname] = value;
|
||||
}
|
||||
|
||||
int CHARACTER::GetProtectTime(const std::string& flagname) const
|
||||
{
|
||||
std::map<std::string, int>::const_iterator it = m_protection_Time.find(flagname);
|
||||
return it != m_protection_Time.end() ? it->second : 0;
|
||||
}
|
||||
|
||||
bool CHARACTER::IsMeley() const
|
||||
{
|
||||
switch (GetRaceNum())
|
||||
{
|
||||
case 6119:
|
||||
case 6230:
|
||||
case 6231:
|
||||
case 9563:
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void CHARACTER::SetQuestItemPtr(LPITEM item)
|
||||
{
|
||||
m_pQuestItem = item;
|
||||
|
||||
@@ -1666,6 +1666,20 @@ class CHARACTER : public CEntity, public CFSM, public CHorseRider
|
||||
DWORD GetQuestNPCID() const { return m_dwQuestNPCVID; }
|
||||
LPCHARACTER GetQuestNPC() const;
|
||||
|
||||
// PORT: AVA2 ENABLE_MELEY_LAIR_DUNGEON. The victim of the pc's last attack (npc.*(1, ...) in a
|
||||
// "when <vnum>.attack" handler), per-character int flags ("IsMeleyBlock" blocks all damage), and
|
||||
// the Meley races, which stand still and cast their mob skills every 5 s.
|
||||
void SetQuestNPCIDAttack(DWORD vid) { m_dwQuestNPCVIDAttack = vid; }
|
||||
LPCHARACTER GetQuestNPCAttack() const;
|
||||
void SetProtectTime(const std::string& flagname, int value);
|
||||
int GetProtectTime(const std::string& flagname) const;
|
||||
bool IsMeley() const;
|
||||
// PORT: AVA2 ENABLE_DEFENSAWE_SHIP. The hydra ship's mast (6801) survives d.kill_all/purge and can be
|
||||
// attacked; the hydra (6812) and its crew (6802-6809) ignore players and go for the mast.
|
||||
bool IsHydraNPC() const { return GetRaceNum() == 6801; }
|
||||
bool IsHydra() const { return GetRaceNum() == 6812; }
|
||||
bool IsHydraMob() const { return (GetRaceNum() >= 6802 && GetRaceNum() <= 6809) || IsHydra(); }
|
||||
|
||||
void SetQuestItemPtr(LPITEM item);
|
||||
void ClearQuestItemPtr();
|
||||
LPITEM GetQuestItemPtr() const;
|
||||
@@ -1680,6 +1694,8 @@ class CHARACTER : public CEntity, public CFSM, public CHorseRider
|
||||
|
||||
private:
|
||||
DWORD m_dwQuestNPCVID;
|
||||
DWORD m_dwQuestNPCVIDAttack; // PORT: AVA2 meley lair
|
||||
std::map<std::string, int> m_protection_Time; // PORT: AVA2 meley lair
|
||||
DWORD m_dwQuestByVnum;
|
||||
LPITEM m_pQuestItem;
|
||||
|
||||
|
||||
@@ -261,6 +261,13 @@ bool CHARACTER::Attack(LPCHARACTER pkVictim, BYTE bType)
|
||||
iRet = ComputeSkill(bType, pkVictim);
|
||||
}
|
||||
|
||||
// PORT: AVA2 ENABLE_MELEY_LAIR_DUNGEON, "when <vnum>.attack" quest event.
|
||||
if (IsPC() && (pkVictim->IsMonster() || pkVictim->IsStone()))
|
||||
{
|
||||
SetQuestNPCIDAttack(pkVictim->GetVID());
|
||||
quest::CQuestManager::instance().Attack(GetPlayerID(), pkVictim->GetRaceNum());
|
||||
}
|
||||
|
||||
//if (test_server && IsPC())
|
||||
// sys_log(0, "%s Attack %s type %u ret %d", GetName(), pkVictim->GetName(), bType, iRet);
|
||||
if (iRet == BATTLE_DAMAGE || iRet == BATTLE_DEAD)
|
||||
@@ -331,7 +338,7 @@ void CHARACTER::DeathPenalty(BYTE bTown)
|
||||
}
|
||||
// END_OF_NO_DEATH_PENALTY_BUG_FIX
|
||||
|
||||
int iLoss = ((GetNextExp() * aiExpLossPercents[MINMAX(1, GetLevel(), PLAYER_EXP_TABLE_MAX)]) / 100);
|
||||
int iLoss = (int) (((unsigned long long) GetNextExp() * aiExpLossPercents[MINMAX(1, GetLevel(), PLAYER_EXP_TABLE_MAX)]) / 100); // PORT: 64-bit, next exp up to 4.2e9
|
||||
|
||||
if (true == LC_IsYMIR())
|
||||
{
|
||||
@@ -1707,6 +1714,13 @@ bool CHARACTER::Damage(LPCHARACTER pAttacker, int dam, EDamageType type) // retu
|
||||
DAMAGE_CRITICAL = (1 << 5),
|
||||
};
|
||||
|
||||
// PORT: AVA2 ENABLE_MELEY_LAIR_DUNGEON. A Meley statue turned to stone (npc.set_protect_time "IsMeleyBlock").
|
||||
if (pAttacker && GetProtectTime("IsMeleyBlock") == 1)
|
||||
{
|
||||
SendDamagePacket(pAttacker, 0, DAMAGE_BLOCK);
|
||||
return false;
|
||||
}
|
||||
|
||||
//PROF_UNIT puAttr("Attr");
|
||||
|
||||
//
|
||||
@@ -2291,6 +2305,11 @@ bool CHARACTER::Damage(LPCHARACTER pAttacker, int dam, EDamageType type) // retu
|
||||
//
|
||||
// !!!!!!!!! 실제 HP를 줄이는 부분 !!!!!!!!!
|
||||
//
|
||||
// PORT: AVA2 meley lair. Only the quest kills a statue (npc.dead_by_vnum); one hit past the last
|
||||
// stage's 30000 HP threshold (MeleyDungeon 6230.attack) left it dead and the lair stuck.
|
||||
if (GetRaceNum() == 6230 && dam >= GetHP())
|
||||
dam = MAX(0, GetHP() - 1);
|
||||
|
||||
if (!cannot_dead)
|
||||
{
|
||||
PointChange(POINT_HP, -dam, false);
|
||||
@@ -3645,7 +3664,8 @@ void CHARACTER::ChangeVictimByAggro(int iNewAggro, LPCHARACTER pNewVictim)
|
||||
if (itFind != m_map_kDamage.end())
|
||||
{
|
||||
m_iMaxAggro = iNewAggro;
|
||||
SetVictim(CHARACTER_MANAGER::instance().Find(itFind->first));
|
||||
if (!IsHydraMob()) // PORT: AVA2, hydra mobs keep hitting the mast
|
||||
SetVictim(CHARACTER_MANAGER::instance().Find(itFind->first));
|
||||
m_dwStateDuration = 1;
|
||||
}
|
||||
}
|
||||
@@ -3654,7 +3674,8 @@ void CHARACTER::ChangeVictimByAggro(int iNewAggro, LPCHARACTER pNewVictim)
|
||||
if (m_iMaxAggro < iNewAggro)
|
||||
{
|
||||
m_iMaxAggro = iNewAggro;
|
||||
SetVictim(pNewVictim);
|
||||
if (!IsHydraMob()) // PORT: AVA2, hydra mobs keep hitting the mast
|
||||
SetVictim(pNewVictim);
|
||||
m_dwStateDuration = 1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
|
||||
BOOL g_test_server;
|
||||
extern LPCHARACTER FindVictim(LPCHARACTER pkChr, int iMaxDistance);
|
||||
extern LPCHARACTER FindVictimHydra(LPCHARACTER pkChr, int iMaxDistance); // PORT: AVA2 port_ava2_dungeon.cpp
|
||||
|
||||
namespace
|
||||
{
|
||||
@@ -620,6 +621,30 @@ void CHARACTER::__StateIdle_NPC()
|
||||
|
||||
void CHARACTER::__StateIdle_Monster()
|
||||
{
|
||||
// PORT: AVA2 ENABLE_MELEY_LAIR_DUNGEON. Meley and her statues never move or melee; Meley casts a
|
||||
// mob skill whenever one is ready, then idles 5 s.
|
||||
if (IsMeley())
|
||||
{
|
||||
if (!IsStone() && time(0) > GetProtectTime("MeleyTime"))
|
||||
{
|
||||
if (HasMobSkill())
|
||||
{
|
||||
for (unsigned int iSkillIdx = 0; iSkillIdx < MOB_SKILL_MAX_NUM; ++iSkillIdx)
|
||||
{
|
||||
if (CanUseMobSkill(iSkillIdx) && UseMobSkill(iSkillIdx))
|
||||
{
|
||||
SendMovePacket(FUNC_MOB_SKILL, iSkillIdx, GetX(), GetY(), 0, get_dword_time());
|
||||
float fDuration = CMotionManager::instance().GetMotionDuration(GetRaceNum(), MAKE_MOTION_KEY(MOTION_MODE_GENERAL, MOTION_SPECIAL_1 + iSkillIdx));
|
||||
m_dwStateDuration = (DWORD) (fDuration == 0.0f ? PASSES_PER_SEC(2) : PASSES_PER_SEC(fDuration));
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
SetProtectTime("MeleyTime", time(0) + 5);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (IsStun())
|
||||
return;
|
||||
|
||||
@@ -665,7 +690,7 @@ void CHARACTER::__StateIdle_Monster()
|
||||
if (GetMapIndex() == 61 && quest::CQuestManager::instance().GetEventFlag("xmas_tree"));
|
||||
// 서한산에서 나무가 있으면 선공하지않는다.
|
||||
else
|
||||
victim = FindVictim(this, m_pkMobData->m_table.wAggressiveSight);
|
||||
victim = IsHydraMob() ? FindVictimHydra(this, 40000) : FindVictim(this, m_pkMobData->m_table.wAggressiveSight); // PORT: AVA2
|
||||
}
|
||||
}
|
||||
|
||||
@@ -949,7 +974,7 @@ void CHARACTER::StateBattle()
|
||||
if (victim && victim->IsDead() &&
|
||||
!no_wander && IsAggressive() && (!GetParty() || GetParty()->GetLeader() == this))
|
||||
{
|
||||
LPCHARACTER new_victim = FindVictim(this, m_pkMobData->m_table.wAggressiveSight);
|
||||
LPCHARACTER new_victim = IsHydraMob() ? FindVictimHydra(this, 40000) : FindVictim(this, m_pkMobData->m_table.wAggressiveSight); // PORT: AVA2
|
||||
|
||||
SetVictim(new_victim);
|
||||
m_dwStateDuration = PASSES_PER_SEC(1);
|
||||
|
||||
@@ -293,22 +293,22 @@ const DWORD exp_table_common[PLAYER_EXP_TABLE_MAX + 1] =
|
||||
2250000000,
|
||||
2280000000,
|
||||
2310000000,
|
||||
2330000000, // 105
|
||||
2350000000,
|
||||
2370000000,
|
||||
2390000000,
|
||||
2400000000,
|
||||
2410000000, // 110
|
||||
2420000000,
|
||||
2430000000,
|
||||
2440000000,
|
||||
2450000000,
|
||||
2460000000, // 115
|
||||
2470000000,
|
||||
2480000000,
|
||||
2490000000,
|
||||
2490000000,
|
||||
2500000000, // 120
|
||||
2330000000, // 105 // PORT: 105-119 rise geometrically to 4.2e9 (docs/FEATURE-LEVEL-120.md); DWORD, player.exp must be INT UNSIGNED
|
||||
2430000000u,
|
||||
2530000000u,
|
||||
2640000000u,
|
||||
2760000000u,
|
||||
2880000000u, // 110
|
||||
3000000000u,
|
||||
3130000000u,
|
||||
3260000000u,
|
||||
3400000000u,
|
||||
3550000000u, // 115
|
||||
3700000000u,
|
||||
3860000000u,
|
||||
4030000000u,
|
||||
4200000000u,
|
||||
4200000000u, // 120 (MAX_LEVEL; never needed)
|
||||
};
|
||||
|
||||
const DWORD exp_table_newcibn[PLAYER_EXP_TABLE_MAX + 1 ] =
|
||||
|
||||
@@ -927,7 +927,7 @@ namespace
|
||||
{
|
||||
LPCHARACTER ch = (LPCHARACTER) ent;
|
||||
|
||||
if (!ch->IsPC() && !ch->IsPet())
|
||||
if (!ch->IsPC() && !ch->IsPet() && !ch->IsHydraNPC()) // PORT: AVA2 hydra mast
|
||||
ch->Dead();
|
||||
}
|
||||
}
|
||||
@@ -942,7 +942,7 @@ namespace
|
||||
{
|
||||
LPCHARACTER ch = (LPCHARACTER) ent;
|
||||
|
||||
if (!ch->IsPC() && !ch->IsPet()) {
|
||||
if (!ch->IsPC() && !ch->IsPet() && !ch->IsHydraNPC()) { // PORT: AVA2 hydra mast
|
||||
M2_DESTROY_CHARACTER(ch);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,406 @@
|
||||
// PORT: AVA2 dungeon quest functions (questlua_dungeon.cpp dracaryS_DUNGEON_LIB + ENABLE_DEFENSAWE_SHIP,
|
||||
// questlua_npc.cpp ENABLE_MELEY_LAIR_DUNGEON, trigger.cpp FindVictimHydra) for the snow dungeon, the hydra
|
||||
// ship defence and Meley's lair (tools/server/ava2-dungeons in the client repo).
|
||||
// Differences from AVA2: d.mission_notice sends a big notice (no CHAT_TYPE_MISSION here); the statue affect
|
||||
// has no visual (AFFECT_STATUE does not exist), the statues only block damage; the npc.*(1|2, ...) selector
|
||||
// reads the number (AVA2 used lua_isnumber, so it always picked the attack victim).
|
||||
#include "stdafx.h"
|
||||
#include "utils.h"
|
||||
#include "config.h"
|
||||
#include "char.h"
|
||||
#include "char_manager.h"
|
||||
#include "dungeon.h"
|
||||
#include "event.h"
|
||||
#include "sectree_manager.h"
|
||||
#include "questmanager.h"
|
||||
#include "questlua.h"
|
||||
#include <climits>
|
||||
#include <cmath>
|
||||
|
||||
extern void SendNoticeMap(const char* c_pszBuf, int nMapIndex, bool bBigFont);
|
||||
|
||||
namespace
|
||||
{
|
||||
template <class F> void ForEachCharInMap(long mapIndex, F f)
|
||||
{
|
||||
LPSECTREE_MAP map = SECTREE_MANAGER::instance().GetMap(mapIndex);
|
||||
if (!map)
|
||||
return;
|
||||
struct Each
|
||||
{
|
||||
F& f;
|
||||
void operator () (LPENTITY ent) { if (ent->IsType(ENTITY_CHARACTER)) f((LPCHARACTER) ent); }
|
||||
} each = { f };
|
||||
map->for_each(each);
|
||||
}
|
||||
|
||||
LPDUNGEON CurrentDungeon() { return quest::CQuestManager::instance().GetCurrentDungeon(); }
|
||||
|
||||
// npc.*(1, ...) = the victim of the pc's last attack, npc.*(2, ...) = the quest npc
|
||||
LPCHARACTER SelectNPC(lua_State* L)
|
||||
{
|
||||
quest::CQuestManager& q = quest::CQuestManager::instance();
|
||||
switch ((int) lua_tonumber(L, 1))
|
||||
{
|
||||
case 1: return q.GetCurrentNPCAttackCharacterPtr();
|
||||
case 2: return q.GetCurrentNPCCharacterPtr();
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
EVENTINFO(warp_all_to_base_event_info)
|
||||
{
|
||||
int x, y;
|
||||
long mapIndex;
|
||||
warp_all_to_base_event_info() : x(0), y(0), mapIndex(0) {}
|
||||
};
|
||||
|
||||
EVENTFUNC(warp_all_to_base_event)
|
||||
{
|
||||
warp_all_to_base_event_info* info = dynamic_cast<warp_all_to_base_event_info*>(event->info);
|
||||
if (!info)
|
||||
return 0;
|
||||
const int x = info->x, y = info->y;
|
||||
ForEachCharInMap(info->mapIndex, [x, y](LPCHARACTER ch) { if (ch->IsPC()) ch->WarpSet(x, y); });
|
||||
return 0;
|
||||
}
|
||||
|
||||
void WarpAllToBase(int x, int y, long mapIndex, int sec)
|
||||
{
|
||||
warp_all_to_base_event_info* info = AllocEventInfo<warp_all_to_base_event_info>();
|
||||
info->x = x;
|
||||
info->y = y;
|
||||
info->mapIndex = mapIndex;
|
||||
event_create(warp_all_to_base_event, info, PASSES_PER_SEC(sec));
|
||||
}
|
||||
|
||||
// The hydra ship's mast: every 2 s its hp goes to the players ("gethydrahp", AVA2's client bar); once it
|
||||
// is gone the defence failed and everyone is sent back to the cape after 15 s.
|
||||
EVENTINFO(hydra_mast_event_info)
|
||||
{
|
||||
DWORD vid;
|
||||
long mapIndex;
|
||||
hydra_mast_event_info() : vid(0), mapIndex(0) {}
|
||||
};
|
||||
|
||||
EVENTFUNC(hydra_mast_event)
|
||||
{
|
||||
hydra_mast_event_info* info = dynamic_cast<hydra_mast_event_info*>(event->info);
|
||||
if (!info || !SECTREE_MANAGER::instance().GetMap(info->mapIndex))
|
||||
return 0;
|
||||
LPCHARACTER mast = CHARACTER_MANAGER::instance().Find(info->vid);
|
||||
if (!mast)
|
||||
{
|
||||
WarpAllToBase(1108200, 1782400, info->mapIndex, 15);
|
||||
// "15秒后将传送出副本。" (GB2312)
|
||||
SendNoticeMap("15\xc3\xeb\xba\xf3\xbd\xab\xb4\xab\xcb\xcd\xb3\xf6\xb8\xb1\xb1\xbe\xa1\xa3", info->mapIndex, false);
|
||||
sys_log(0, "%ld MapIndex defensawe ship unsuccess", info->mapIndex);
|
||||
if (LPDUNGEON dungeon = CDungeonManager::instance().FindByMapIndex(info->mapIndex))
|
||||
dungeon->SetFlag("Complete", 1);
|
||||
return 0;
|
||||
}
|
||||
const int hp = mast->GetHP();
|
||||
ForEachCharInMap(info->mapIndex, [hp](LPCHARACTER ch) { if (ch->IsPC()) ch->ChatPacket(CHAT_TYPE_COMMAND, "gethydrahp %d", hp); });
|
||||
return PASSES_PER_SEC(2);
|
||||
}
|
||||
}
|
||||
|
||||
// The hydra and its crew only go for the mast (AVA2 FuncFindMobHydraVictim without the building case).
|
||||
LPCHARACTER FindVictimHydra(LPCHARACTER pkChr, int iMaxDistance)
|
||||
{
|
||||
struct Find
|
||||
{
|
||||
LPCHARACTER self, victim;
|
||||
int best, max;
|
||||
void operator () (LPENTITY ent)
|
||||
{
|
||||
if (!ent->IsType(ENTITY_CHARACTER))
|
||||
return;
|
||||
LPCHARACTER ch = (LPCHARACTER) ent;
|
||||
if (!ch->IsHydraNPC() || ch->IsDead())
|
||||
return;
|
||||
const int d = DISTANCE_APPROX(self->GetX() - ch->GetX(), self->GetY() - ch->GetY());
|
||||
if (d < best && d <= max)
|
||||
{
|
||||
victim = ch;
|
||||
best = d;
|
||||
}
|
||||
}
|
||||
} f = { pkChr, NULL, INT_MAX, iMaxDistance };
|
||||
if (pkChr->GetSectree())
|
||||
pkChr->GetSectree()->ForEachAround(f);
|
||||
return f.victim;
|
||||
}
|
||||
|
||||
namespace quest
|
||||
{
|
||||
// d.mission_notice(map index, text)
|
||||
int dungeon_mission_notice(lua_State* L)
|
||||
{
|
||||
LPDUNGEON dungeon = CurrentDungeon();
|
||||
if (!dungeon || !lua_isstring(L, 2))
|
||||
return 0;
|
||||
const std::string text = lua_tostring(L, 2);
|
||||
ForEachCharInMap(lua_isnumber(L, 1) ? (long) lua_tonumber(L, 1) : dungeon->GetMapIndex(),
|
||||
[&text](LPCHARACTER ch) { if (ch->IsPC()) ch->ChatPacket(CHAT_TYPE_BIG_NOTICE, "%s", text.c_str()); });
|
||||
return 0;
|
||||
}
|
||||
|
||||
// d.global_warp_all_to_base(x, y, map index, seconds)
|
||||
int dungeon_global_warp_all_to_base(lua_State* L)
|
||||
{
|
||||
WarpAllToBase((int) lua_tonumber(L, 1), (int) lua_tonumber(L, 2), (long) lua_tonumber(L, 3), (int) lua_tonumber(L, 4));
|
||||
return 0;
|
||||
}
|
||||
|
||||
// d.new_kill_all(): kill_all that spares the hydra mast
|
||||
int dungeon_new_kill_all(lua_State* L)
|
||||
{
|
||||
if (LPDUNGEON dungeon = CurrentDungeon())
|
||||
dungeon->KillAll();
|
||||
return 0;
|
||||
}
|
||||
|
||||
// d.command(cmd): a CHAT_TYPE_COMMAND line to every player in the dungeon
|
||||
int dungeon_command(lua_State* L)
|
||||
{
|
||||
LPDUNGEON dungeon = CurrentDungeon();
|
||||
if (!dungeon || !lua_isstring(L, 1))
|
||||
return 0;
|
||||
const std::string text = lua_tostring(L, 1);
|
||||
ForEachCharInMap(dungeon->GetMapIndex(), [&text](LPCHARACTER ch) { if (ch->IsPC()) ch->ChatPacket(CHAT_TYPE_COMMAND, "%s", text.c_str()); });
|
||||
return 0;
|
||||
}
|
||||
|
||||
// d.dungeon_remove_all(vnum): takes up to 99 of the item from every player in the dungeon
|
||||
int dungeon_remove_all_item(lua_State* L)
|
||||
{
|
||||
LPDUNGEON dungeon = CurrentDungeon();
|
||||
if (!dungeon || !lua_isnumber(L, 1))
|
||||
return 0;
|
||||
const DWORD vnum = (DWORD) lua_tonumber(L, 1);
|
||||
ForEachCharInMap(dungeon->GetMapIndex(), [vnum](LPCHARACTER ch) { if (ch->IsPC()) ch->RemoveSpecifyItem(vnum, 99); });
|
||||
return 0;
|
||||
}
|
||||
|
||||
// d.kill_area(x1, y1, x2, y2): destroys the monsters and stones inside the global rectangle
|
||||
int dungeon_kill_area(lua_State* L)
|
||||
{
|
||||
LPDUNGEON dungeon = CurrentDungeon();
|
||||
if (!dungeon || !lua_isnumber(L, 1) || !lua_isnumber(L, 2) || !lua_isnumber(L, 3) || !lua_isnumber(L, 4))
|
||||
return 0;
|
||||
const long x1 = (long) lua_tonumber(L, 1), y1 = (long) lua_tonumber(L, 2), x2 = (long) lua_tonumber(L, 3), y2 = (long) lua_tonumber(L, 4);
|
||||
LPCHARACTER except = CQuestManager::instance().GetCurrentNPCCharacterPtr();
|
||||
std::vector<LPCHARACTER> victims;
|
||||
ForEachCharInMap(dungeon->GetMapIndex(), [&](LPCHARACTER ch) {
|
||||
if (ch != except && !ch->IsPet() && !ch->GetRider() && (ch->IsMonster() || ch->IsStone()) &&
|
||||
x1 <= ch->GetX() && ch->GetX() <= x2 && y1 <= ch->GetY() && ch->GetY() <= y2)
|
||||
victims.push_back(ch);
|
||||
});
|
||||
for (LPCHARACTER ch : victims)
|
||||
M2_DESTROY_CHARACTER(ch);
|
||||
return 0;
|
||||
}
|
||||
|
||||
// d.spawn_mob_new(vnum, x, y[, radius[, count]]): d.spawn_mob plus the hydra mast watch; returns the last vid
|
||||
int dungeon_spawn_mob_new(lua_State* L)
|
||||
{
|
||||
LPDUNGEON dungeon = CurrentDungeon();
|
||||
if (!dungeon || !lua_isnumber(L, 1) || !lua_isnumber(L, 2) || !lua_isnumber(L, 3))
|
||||
return 0;
|
||||
const DWORD vnum = (DWORD) lua_tonumber(L, 1);
|
||||
const long x = (long) lua_tonumber(L, 2), y = (long) lua_tonumber(L, 3);
|
||||
const float radius = lua_isnumber(L, 4) ? (float) lua_tonumber(L, 4) : 0;
|
||||
DWORD count = lua_isnumber(L, 5) ? (DWORD) lua_tonumber(L, 5) : 1;
|
||||
DWORD vid = 0;
|
||||
for (count = count ? count : 1; count--; )
|
||||
{
|
||||
long nx = x, ny = y;
|
||||
if (radius >= 1)
|
||||
{
|
||||
const float angle = number(0, 999) * M_PI * 2 / 1000, r = number(0, 999) * radius / 1000;
|
||||
nx += (long) (r * cos(angle));
|
||||
ny += (long) (r * sin(angle));
|
||||
}
|
||||
LPCHARACTER mob = dungeon->SpawnMob(vnum, nx, ny);
|
||||
if (!mob)
|
||||
continue;
|
||||
vid = mob->GetVID();
|
||||
hydra_mast_event_info* info = AllocEventInfo<hydra_mast_event_info>();
|
||||
info->vid = vid;
|
||||
info->mapIndex = dungeon->GetMapIndex();
|
||||
event_create(hydra_mast_event, info, PASSES_PER_SEC(1));
|
||||
}
|
||||
lua_pushnumber(L, vid);
|
||||
return 1;
|
||||
}
|
||||
|
||||
// npc.get_protect_time(1|2, flag)
|
||||
int npc_get_protect_time(lua_State* L)
|
||||
{
|
||||
LPCHARACTER ch = lua_isstring(L, 2) ? SelectNPC(L) : NULL;
|
||||
lua_pushnumber(L, ch ? ch->GetProtectTime(lua_tostring(L, 2)) : 0);
|
||||
return 1;
|
||||
}
|
||||
|
||||
// npc.set_protect_time(1|2, flag, value)
|
||||
int npc_set_protect_time(lua_State* L)
|
||||
{
|
||||
LPCHARACTER ch = lua_isstring(L, 2) && lua_isnumber(L, 3) ? SelectNPC(L) : NULL;
|
||||
if (ch)
|
||||
ch->SetProtectTime(lua_tostring(L, 2), (int) rint(lua_tonumber(L, 3)));
|
||||
return 0;
|
||||
}
|
||||
|
||||
// npc.set_statu_affect(1|2, look): AVA2 turns the statue to stone; only remembered here
|
||||
int npc_set_statu_affect(lua_State* L)
|
||||
{
|
||||
if (LPCHARACTER ch = lua_isnumber(L, 2) ? SelectNPC(L) : NULL)
|
||||
ch->SetProtectTime("Statue", (int) lua_tonumber(L, 2));
|
||||
return 0;
|
||||
}
|
||||
|
||||
// npc.set_statu_clear_aff(map index)
|
||||
int npc_set_statu_clear_aff(lua_State* L)
|
||||
{
|
||||
ForEachCharInMap((long) lua_tonumber(L, 1), [](LPCHARACTER ch) { if (ch->IsStone() || ch->IsMonster()) ch->SetProtectTime("Statue", 0); });
|
||||
return 0;
|
||||
}
|
||||
|
||||
// npc.show_end_statu(map index)
|
||||
int npc_show_end_statu(lua_State* L)
|
||||
{
|
||||
ForEachCharInMap((long) lua_tonumber(L, 1), [](LPCHARACTER ch) { if (ch->IsStone() || ch->IsMonster()) ch->SetProtectTime("Statue", 3); });
|
||||
return 0;
|
||||
}
|
||||
|
||||
// npc.dead_by_vnum(map index, vnum)
|
||||
int npc_dead_by_vnum(lua_State* L)
|
||||
{
|
||||
const DWORD vnum = (DWORD) lua_tonumber(L, 2);
|
||||
std::vector<LPCHARACTER> victims;
|
||||
ForEachCharInMap((long) lua_tonumber(L, 1), [&](LPCHARACTER ch) { if (!ch->IsPC() && ch->GetRaceNum() == vnum && !ch->IsDead()) victims.push_back(ch); });
|
||||
for (LPCHARACTER ch : victims)
|
||||
ch->Dead();
|
||||
return 0;
|
||||
}
|
||||
|
||||
// npc.show_statu(map index): re-sends every monster and stone to the players around it
|
||||
int npc_show_statu(lua_State* L)
|
||||
{
|
||||
std::vector<LPCHARACTER> mobs;
|
||||
ForEachCharInMap((long) lua_tonumber(L, 1), [&](LPCHARACTER ch) { if (ch->IsStone() || ch->IsMonster()) mobs.push_back(ch); });
|
||||
for (LPCHARACTER ch : mobs)
|
||||
ch->Show(ch->GetMapIndex(), ch->GetX(), ch->GetY(), ch->GetZ(), true);
|
||||
return 0;
|
||||
}
|
||||
|
||||
// npc.set_meley_hp(map index, vnum, hp)
|
||||
int npc_set_meley_hp(lua_State* L)
|
||||
{
|
||||
const DWORD vnum = (DWORD) lua_tonumber(L, 2);
|
||||
const int hp = (int) lua_tonumber(L, 3);
|
||||
ForEachCharInMap((long) lua_tonumber(L, 1), [vnum, hp](LPCHARACTER ch) {
|
||||
if (!ch->IsPC() && ch->GetRaceNum() == vnum)
|
||||
{
|
||||
ch->SetHP(hp);
|
||||
ch->UpdatePacket();
|
||||
}
|
||||
});
|
||||
return 0;
|
||||
}
|
||||
|
||||
// npc.set_protect_flag2(map index, flag, value): on every monster and stone
|
||||
int npc_set_protect_flag2(lua_State* L)
|
||||
{
|
||||
if (!lua_isnumber(L, 1) || !lua_isstring(L, 2) || !lua_isnumber(L, 3))
|
||||
return 0;
|
||||
const std::string flag = lua_tostring(L, 2);
|
||||
const int value = (int) lua_tonumber(L, 3);
|
||||
ForEachCharInMap((long) lua_tonumber(L, 1), [&](LPCHARACTER ch) { if (ch->IsStone() || ch->IsMonster()) ch->SetProtectTime(flag, value); });
|
||||
return 0;
|
||||
}
|
||||
|
||||
LPCHARACTER HPTarget(lua_State* L)
|
||||
{
|
||||
switch ((int) lua_tonumber(L, 1))
|
||||
{
|
||||
case 1: return CQuestManager::instance().GetCurrentNPCAttackCharacterPtr();
|
||||
case 2: return CHARACTER_MANAGER::instance().Find((DWORD) lua_tonumber(L, 2));
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// npc.get_hp(1) = attack victim, npc.get_hp(2, vid)
|
||||
int npc_get_hp(lua_State* L)
|
||||
{
|
||||
LPCHARACTER ch = HPTarget(L);
|
||||
if (!ch)
|
||||
return 0;
|
||||
lua_pushnumber(L, ch->GetHP());
|
||||
return 1;
|
||||
}
|
||||
|
||||
// npc.set_hp(1, _, hp) / npc.set_hp(2, vid, hp)
|
||||
int npc_set_hp(lua_State* L)
|
||||
{
|
||||
if (LPCHARACTER ch = HPTarget(L))
|
||||
{
|
||||
ch->SetHP((int) lua_tonumber(L, 3));
|
||||
ch->UpdatePacket();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void AddLuaFunctions(lua_State* L, const char* table, const luaL_reg* reg)
|
||||
{
|
||||
lua_getglobal(L, table);
|
||||
if (!lua_istable(L, -1))
|
||||
{
|
||||
lua_pop(L, 1);
|
||||
sys_err("AVA2 dungeon functions: no lua table %s", table);
|
||||
return;
|
||||
}
|
||||
for (; reg->name; ++reg)
|
||||
{
|
||||
lua_pushstring(L, reg->name);
|
||||
lua_pushcfunction(L, reg->func);
|
||||
lua_rawset(L, -3);
|
||||
}
|
||||
lua_pop(L, 1);
|
||||
}
|
||||
|
||||
// Called after RegisterDungeonFunctionTable/RegisterNPCFunctionTable built the d and npc tables.
|
||||
void RegisterAva2DungeonFunctionTable()
|
||||
{
|
||||
static const luaL_reg dungeon_functions[] =
|
||||
{
|
||||
{ "mission_notice", dungeon_mission_notice },
|
||||
{ "global_warp_all_to_base", dungeon_global_warp_all_to_base },
|
||||
{ "new_kill_all", dungeon_new_kill_all },
|
||||
{ "command", dungeon_command },
|
||||
{ "dungeon_remove_all", dungeon_remove_all_item },
|
||||
{ "kill_area", dungeon_kill_area },
|
||||
{ "spawn_mob_new", dungeon_spawn_mob_new },
|
||||
{ NULL, NULL }
|
||||
};
|
||||
static const luaL_reg npc_functions[] =
|
||||
{
|
||||
{ "get_protect_time", npc_get_protect_time },
|
||||
{ "set_protect_time", npc_set_protect_time },
|
||||
{ "set_statu_affect", npc_set_statu_affect },
|
||||
{ "set_statu_clear_aff", npc_set_statu_clear_aff },
|
||||
{ "show_statu", npc_show_statu },
|
||||
{ "set_meley_hp", npc_set_meley_hp },
|
||||
{ "show_end_statu", npc_show_end_statu },
|
||||
{ "set_protect_flag2", npc_set_protect_flag2 },
|
||||
{ "dead_by_vnum", npc_dead_by_vnum },
|
||||
{ "set_hp", npc_set_hp },
|
||||
{ "get_hp", npc_get_hp },
|
||||
{ NULL, NULL }
|
||||
};
|
||||
lua_State* L = CQuestManager::instance().GetLuaState();
|
||||
AddLuaFunctions(L, "d", dungeon_functions);
|
||||
AddLuaFunctions(L, "npc", npc_functions);
|
||||
}
|
||||
}
|
||||
@@ -349,6 +349,7 @@ bool CPVPManager::CanAttack(LPCHARACTER pkChr, LPCHARACTER pkVictim)
|
||||
switch (pkVictim->GetCharType())
|
||||
{
|
||||
case CHAR_TYPE_NPC:
|
||||
return pkVictim->IsHydraNPC(); // PORT: AVA2 hydra mast, the ship's monsters attack it
|
||||
case CHAR_TYPE_WARP:
|
||||
case CHAR_TYPE_GOTO:
|
||||
return false;
|
||||
|
||||
@@ -58,6 +58,7 @@ namespace quest
|
||||
QUEST_ITEM_PICK_EVENT,
|
||||
QUEST_SIG_USE_EVENT,
|
||||
QUEST_ITEM_INFORMER_EVENT,
|
||||
QUEST_ATTACK_EVENT, // PORT: AVA2 ENABLE_MELEY_LAIR_DUNGEON (when <vnum>.attack)
|
||||
QUEST_EVENT_COUNT
|
||||
};
|
||||
|
||||
|
||||
@@ -490,6 +490,7 @@ namespace quest
|
||||
RegisterDragonLairFunctionTable();
|
||||
RegisterSpeedServerFunctionTable();
|
||||
RegisterDragonSoulFunctionTable();
|
||||
RegisterAva2DungeonFunctionTable(); // PORT: after the d and npc tables
|
||||
|
||||
{
|
||||
luaL_reg member_functions[] =
|
||||
|
||||
@@ -34,6 +34,7 @@ namespace quest
|
||||
extern void RegisterDragonLairFunctionTable();
|
||||
extern void RegisterSpeedServerFunctionTable();
|
||||
extern void RegisterDragonSoulFunctionTable();
|
||||
extern void RegisterAva2DungeonFunctionTable(); // PORT: AVA2 port_ava2_dungeon.cpp, extends d and npc
|
||||
|
||||
extern void combine_lua_string(lua_State* L, std::ostringstream &s);
|
||||
|
||||
|
||||
@@ -80,6 +80,7 @@ namespace quest
|
||||
m_mapEventName.insert(TEventNameMap::value_type("pick", QUEST_ITEM_PICK_EVENT)); // 떨어져있는 아이템을 습득함.
|
||||
m_mapEventName.insert(TEventNameMap::value_type("sig_use", QUEST_SIG_USE_EVENT)); // Special item group에 속한 아이템을 사용함.
|
||||
m_mapEventName.insert(TEventNameMap::value_type("item_informer", QUEST_ITEM_INFORMER_EVENT)); // 독일선물기능테스트
|
||||
m_mapEventName.insert(TEventNameMap::value_type("attack", QUEST_ATTACK_EVENT)); // PORT: AVA2 meley lair
|
||||
|
||||
m_bNoSend = false;
|
||||
|
||||
@@ -1078,6 +1079,27 @@ namespace quest
|
||||
return GetCurrentCharacterPtr() ? GetCurrentCharacterPtr()->GetQuestNPC() : NULL;
|
||||
}
|
||||
|
||||
// PORT: AVA2 ENABLE_MELEY_LAIR_DUNGEON. The monster/stone the current pc just attacked (when <vnum>.attack).
|
||||
LPCHARACTER CQuestManager::GetCurrentNPCAttackCharacterPtr()
|
||||
{
|
||||
return GetCurrentCharacterPtr() ? GetCurrentCharacterPtr()->GetQuestNPCAttack() : NULL;
|
||||
}
|
||||
|
||||
void CQuestManager::Attack(unsigned int pc, unsigned int npc)
|
||||
{
|
||||
PC * pPC;
|
||||
|
||||
if ((pPC = GetPC(pc)))
|
||||
{
|
||||
if (!CheckQuestLoaded(pPC))
|
||||
return;
|
||||
|
||||
m_mapNPC[npc].OnAttack(*pPC);
|
||||
}
|
||||
else
|
||||
sys_err("QUEST: no such pc id : %d", pc);
|
||||
}
|
||||
|
||||
const string & CQuestManager::GetCurrentQuestName()
|
||||
{
|
||||
return GetCurrentPC()->GetCurrentQuestName();
|
||||
|
||||
@@ -58,6 +58,7 @@ namespace quest
|
||||
|
||||
//void SetCurrentNPCCharacterPtr(LPCHARACTER ch) { m_pkCurrentNPC = ch; }
|
||||
LPCHARACTER GetCurrentNPCCharacterPtr();
|
||||
LPCHARACTER GetCurrentNPCAttackCharacterPtr(); // PORT: AVA2 meley lair
|
||||
|
||||
void SetCurrentEventIndex(int index) { m_iRunningEventIndex = index; }
|
||||
|
||||
@@ -84,6 +85,7 @@ namespace quest
|
||||
bool Timer(unsigned int pc, unsigned int npc);
|
||||
bool Click(unsigned int pc, LPCHARACTER pkNPC);
|
||||
void Kill(unsigned int pc, unsigned int npc);
|
||||
void Attack(unsigned int pc, unsigned int npc); // PORT: AVA2 meley lair
|
||||
void LevelUp(unsigned int pc);
|
||||
void AttrIn(unsigned int pc, LPCHARACTER ch, int attr);
|
||||
void AttrOut(unsigned int pc, LPCHARACTER ch, int attr);
|
||||
|
||||
@@ -323,6 +323,12 @@ namespace quest
|
||||
}
|
||||
}
|
||||
|
||||
// PORT: AVA2 ENABLE_MELEY_LAIR_DUNGEON
|
||||
bool NPC::OnAttack(PC& pc)
|
||||
{
|
||||
return HandleReceiveAllEvent(pc, QUEST_ATTACK_EVENT);
|
||||
}
|
||||
|
||||
bool NPC::OnPartyKill(PC & pc)
|
||||
{
|
||||
if (m_vnum)
|
||||
|
||||
@@ -53,6 +53,7 @@ namespace quest
|
||||
bool OnClick(PC& pc);
|
||||
bool OnKill(PC& pc);
|
||||
bool OnPartyKill(PC& pc);
|
||||
bool OnAttack(PC& pc); // PORT: AVA2 meley lair
|
||||
bool OnTimer(PC& pc);
|
||||
bool OnLevelUp(PC& pc);
|
||||
bool OnLogin(PC& pc, const char * c_pszQuestName = NULL);
|
||||
|
||||
@@ -638,7 +638,7 @@ namespace quest
|
||||
case RewardData::REWARD_TYPE_EXP:
|
||||
sys_log(0, "EXP cur %d add %d next %d",ch->GetExp(), it->value1, ch->GetNextExp());
|
||||
|
||||
if (ch->GetExp() + it->value1 > ch->GetNextExp())
|
||||
if ((unsigned long long) ch->GetExp() + it->value1 > ch->GetNextExp()) // PORT: 64-bit, next exp up to 4.2e9
|
||||
ch->PointChange(POINT_EXP, ch->GetNextExp() - 1 - ch->GetExp());
|
||||
else
|
||||
ch->PointChange(POINT_EXP, it->value1);
|
||||
|
||||
Reference in New Issue
Block a user