Initial commit
Update char.cpp
This commit is contained in:
2
.gitattributes
vendored
Normal file
2
.gitattributes
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
# Auto detect text files and perform LF normalization
|
||||
* text=auto
|
||||
7
how-to/LocaleSrv-Quest/example/receive_item_test.quest
Normal file
7
how-to/LocaleSrv-Quest/example/receive_item_test.quest
Normal file
@ -0,0 +1,7 @@
|
||||
quest receive_item_test begin
|
||||
state start begin
|
||||
when 70001.receive begin
|
||||
syschat(string.format("(TEST) -> Count Item: %d", pc.count_item(70001)))
|
||||
end
|
||||
end
|
||||
end
|
||||
24
how-to/LocaleSrv-Quest/example/swap_item_example.quest
Normal file
24
how-to/LocaleSrv-Quest/example/swap_item_example.quest
Normal file
@ -0,0 +1,24 @@
|
||||
quest swap_item begin
|
||||
state start begin
|
||||
when 70001.receive begin
|
||||
|
||||
local item_to_change = 70001
|
||||
local count_needed = 10
|
||||
|
||||
local reward_vnum = 19
|
||||
local reward_count = 1
|
||||
|
||||
while(pc.count_item(item_to_change) >= count_needed) do
|
||||
if not pc.enough_inventory(reward_vnum) then
|
||||
syschat("You don't have enough space to receive the item, free up space.")
|
||||
syschat("After freeing up space, you will have to receive it again.")
|
||||
break
|
||||
end
|
||||
pc.remove_item(item_to_change, count_needed)
|
||||
pc.give_item2(reward_vnum, reward_count)
|
||||
syschat(string.format("Congratulations! You have collected %s x %d! In return you will receive: %s x %d", item.get_name(item_to_change), count_needed, item.get_name(reward_vnum), reward_count ))
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
3
how-to/Srcs-Server/common/service or CommonDefines.h
Normal file
3
how-to/Srcs-Server/common/service or CommonDefines.h
Normal file
@ -0,0 +1,3 @@
|
||||
// Add:
|
||||
|
||||
#define ENABLE_QUEST_RECEIVE_ITEM
|
||||
15
how-to/Srcs-Server/game/src/char.cpp
Normal file
15
how-to/Srcs-Server/game/src/char.cpp
Normal file
@ -0,0 +1,15 @@
|
||||
//1.) Search:
|
||||
|
||||
int CHARACTER::GetSkillPowerByLevel(int level, bool bMob) const
|
||||
{
|
||||
return CTableBySkill::instance().GetSkillPowerByLevelFromType(GetJob(), GetSkillGroup(), MINMAX(0, level, SKILL_MAX_LEVEL), bMob);
|
||||
}
|
||||
|
||||
// and add under, this:
|
||||
|
||||
#ifdef ENABLE_QUEST_RECEIVE_ITEM
|
||||
void CHARACTER::SenderRecvItem(unsigned int pc, LPITEM item)
|
||||
{
|
||||
quest::CQuestManager::instance().ReceiveItem(pc, item);
|
||||
}
|
||||
#endif
|
||||
10
how-to/Srcs-Server/game/src/char.h
Normal file
10
how-to/Srcs-Server/game/src/char.h
Normal file
@ -0,0 +1,10 @@
|
||||
//1.) Search:
|
||||
|
||||
public:
|
||||
int GetSkillPowerByLevel(int level, bool bMob = false) const;
|
||||
|
||||
// and add under, this:
|
||||
|
||||
#ifdef ENABLE_QUEST_RECEIVE_ITEM
|
||||
void SenderRecvItem(unsigned int pc, LPITEM item);
|
||||
#endif
|
||||
51
how-to/Srcs-Server/game/src/char_item.cpp
Normal file
51
how-to/Srcs-Server/game/src/char_item.cpp
Normal file
@ -0,0 +1,51 @@
|
||||
//1.) Search:
|
||||
|
||||
item2->SetCount(item2->GetCount() + bCount2);
|
||||
|
||||
if (bCount == 0)
|
||||
{
|
||||
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("아이템 획득: %s"), item2->GetName());
|
||||
M2_DESTROY_ITEM(item);
|
||||
if (item2->GetType() == ITEM_QUEST)
|
||||
quest::CQuestManager::instance().PickupItem (GetPlayerID(), item2);
|
||||
|
||||
// and add under, this:
|
||||
|
||||
#ifdef ENABLE_QUEST_RECEIVE_ITEM
|
||||
SenderRecvItem(GetPlayerID(), item2);
|
||||
#endif
|
||||
|
||||
//2.) Search:
|
||||
|
||||
char szHint[32+1];
|
||||
snprintf(szHint, sizeof(szHint), "%s %u %u", item->GetName(), item->GetCount(), item->GetOriginalVnum());
|
||||
LogManager::instance().ItemLog(this, item, "GET", szHint);
|
||||
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("아이템 획득: %s"), item->GetName());
|
||||
|
||||
if (item->GetType() == ITEM_QUEST)
|
||||
quest::CQuestManager::instance().PickupItem (GetPlayerID(), item);
|
||||
|
||||
// and add under, this:
|
||||
|
||||
#ifdef ENABLE_QUEST_RECEIVE_ITEM
|
||||
SenderRecvItem(GetPlayerID(), item);
|
||||
#endif
|
||||
|
||||
//3.) Search:
|
||||
|
||||
if (owner == this)
|
||||
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("아이템 획득: %s"), item->GetName());
|
||||
else
|
||||
{
|
||||
owner->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("아이템 획득: %s 님으로부터 %s"), GetName(), item->GetName());
|
||||
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("아이템 전달: %s 님에게 %s"), owner->GetName(), item->GetName());
|
||||
}
|
||||
|
||||
if (item->GetType() == ITEM_QUEST)
|
||||
quest::CQuestManager::instance().PickupItem (owner->GetPlayerID(), item);
|
||||
|
||||
// and add under, this:
|
||||
|
||||
#ifdef ENABLE_QUEST_RECEIVE_ITEM
|
||||
owner->SenderRecvItem(owner->GetPlayerID(), item);
|
||||
#endif
|
||||
12
how-to/Srcs-Server/game/src/cmd_gm.cpp
Normal file
12
how-to/Srcs-Server/game/src/cmd_gm.cpp
Normal file
@ -0,0 +1,12 @@
|
||||
//1.) Search:
|
||||
|
||||
if (iEmptyPos != -1)
|
||||
{
|
||||
item->AddToCharacter(ch, TItemPos(INVENTORY, iEmptyPos));
|
||||
LogManager::instance().ItemLog(ch, item, "GM", item->GetName());
|
||||
|
||||
// and add under, this:
|
||||
|
||||
#ifdef ENABLE_QUEST_RECEIVE_ITEM
|
||||
ch->SenderRecvItem(ch->GetPlayerID(), item);
|
||||
#endif
|
||||
10
how-to/Srcs-Server/game/src/exchange.cpp
Normal file
10
how-to/Srcs-Server/game/src/exchange.cpp
Normal file
@ -0,0 +1,10 @@
|
||||
//1.) Search:
|
||||
|
||||
m_apItems[i] = NULL;
|
||||
}
|
||||
|
||||
// and add before, this:
|
||||
|
||||
#ifdef ENABLE_QUEST_RECEIVE_ITEM
|
||||
victim->SenderRecvItem(victim->GetPlayerID(), item);
|
||||
#endif
|
||||
9
how-to/Srcs-Server/game/src/quest.h
Normal file
9
how-to/Srcs-Server/game/src/quest.h
Normal file
@ -0,0 +1,9 @@
|
||||
//1.) Search:
|
||||
|
||||
QUEST_ITEM_INFORMER_EVENT,
|
||||
|
||||
// and add under, this:
|
||||
|
||||
#ifdef ENABLE_QUEST_RECEIVE_ITEM
|
||||
QUEST_ITEM_RECEIVE_EVENT,
|
||||
#endif
|
||||
50
how-to/Srcs-Server/game/src/questmanager.cpp
Normal file
50
how-to/Srcs-Server/game/src/questmanager.cpp
Normal file
@ -0,0 +1,50 @@
|
||||
//1.) Search:
|
||||
|
||||
m_mapEventName.insert(TEventNameMap::value_type("item_informer", QUEST_ITEM_INFORMER_EVENT));
|
||||
|
||||
// and add under, this:
|
||||
|
||||
#ifdef ENABLE_QUEST_RECEIVE_ITEM
|
||||
m_mapEventName.insert(TEventNameMap::value_type("receive", QUEST_ITEM_RECEIVE_EVENT));
|
||||
#endif
|
||||
|
||||
//2.) Search:
|
||||
|
||||
void CQuestManager::AttrOut(unsigned int pc, LPCHARACTER ch, int attr)
|
||||
{
|
||||
...
|
||||
}
|
||||
|
||||
// and add under the whole function, this:
|
||||
|
||||
#ifdef ENABLE_QUEST_RECEIVE_ITEM
|
||||
bool CQuestManager::ReceiveItem(unsigned int pc, LPITEM item)
|
||||
{
|
||||
if (test_server)
|
||||
sys_log(0, "questmanager::ReceiveItem Start : itemVnum : %d PC : %d", item->GetOriginalVnum(), pc);
|
||||
|
||||
PC* pPC;
|
||||
if ((pPC = GetPC(pc)))
|
||||
{
|
||||
if (!CheckQuestLoaded(pPC))
|
||||
{
|
||||
LPCHARACTER ch = CHARACTER_MANAGER::instance().FindByPID(pc);
|
||||
if (ch)
|
||||
{
|
||||
ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʈ<EFBFBD><EFBFBD> <20>ε<EFBFBD><CEB5>ϴ<EFBFBD> <20><><EFBFBD>Դϴ<D4B4>. <20><>ø<EFBFBD> <20><>ٷ<EFBFBD> <20>ֽʽÿ<CABD>."));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// call script
|
||||
SetCurrentItem(item);
|
||||
|
||||
return m_mapNPC[item->GetVnum()].OnReceive(*pPC);
|
||||
}
|
||||
else
|
||||
{
|
||||
sys_err("QUEST RECEIVE_ITEM_EVENT no such pc id : %d", pc);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
9
how-to/Srcs-Server/game/src/questmanager.h
Normal file
9
how-to/Srcs-Server/game/src/questmanager.h
Normal file
@ -0,0 +1,9 @@
|
||||
//1.) Search:
|
||||
|
||||
void AttrOut(unsigned int pc, LPCHARACTER ch, int attr);
|
||||
|
||||
// and add under, this:
|
||||
|
||||
#ifdef ENABLE_QUEST_RECEIVE_ITEM
|
||||
bool ReceiveItem(unsigned int pc, LPITEM item);
|
||||
#endif
|
||||
18
how-to/Srcs-Server/game/src/questnpc.cpp
Normal file
18
how-to/Srcs-Server/game/src/questnpc.cpp
Normal file
@ -0,0 +1,18 @@
|
||||
//1.) Search:
|
||||
|
||||
bool NPC::OnTakeItem(PC& pc)
|
||||
{
|
||||
...
|
||||
}
|
||||
|
||||
// and add before, this:
|
||||
|
||||
#ifdef ENABLE_QUEST_RECEIVE_ITEM
|
||||
bool NPC::OnReceive(PC& pc)
|
||||
{
|
||||
if (m_vnum == 0)
|
||||
return HandleReceiveAllEvent(pc, QUEST_ITEM_RECEIVE_EVENT);
|
||||
else
|
||||
return HandleEvent(pc, QUEST_ITEM_RECEIVE_EVENT);
|
||||
}
|
||||
#endif
|
||||
9
how-to/Srcs-Server/game/src/questnpc.h
Normal file
9
how-to/Srcs-Server/game/src/questnpc.h
Normal file
@ -0,0 +1,9 @@
|
||||
//1.) Search:
|
||||
|
||||
bool OnAttrOut(PC& pc);
|
||||
|
||||
// and add after, this:
|
||||
|
||||
#ifdef ENABLE_QUEST_RECEIVE_ITEM
|
||||
bool OnReceive(PC& pc);
|
||||
#endif
|
||||
18
how-to/Srcs-Server/game/src/shop.cpp
Normal file
18
how-to/Srcs-Server/game/src/shop.cpp
Normal file
@ -0,0 +1,18 @@
|
||||
//1.) Search:
|
||||
|
||||
if (item->GetVnum() >= 80003 && item->GetVnum() <= 80007)
|
||||
{
|
||||
LogManager::instance().GoldBarLog(ch->GetPlayerID(), item->GetID(), PERSONAL_SHOP_BUY, "");
|
||||
}
|
||||
|
||||
DBManager::instance().SendMoneyLog(MONEY_LOG_SHOP, item->GetVnum(), -dwPrice);
|
||||
}
|
||||
|
||||
if (item)
|
||||
sys_log(0, "SHOP: BUY: name %s %s(x %d):%u price %u", ch->GetName(), item->GetName(), item->GetCount(), item->GetID(), dwPrice);
|
||||
|
||||
// and add under, this:
|
||||
|
||||
#ifdef ENABLE_QUEST_RECEIVE_ITEM
|
||||
ch->SenderRecvItem(ch->GetPlayerID(), item);
|
||||
#endif
|
||||
17
how-to/Srcs-Server/game/src/shopEx.cpp
Normal file
17
how-to/Srcs-Server/game/src/shopEx.cpp
Normal file
@ -0,0 +1,17 @@
|
||||
//1.) Search:
|
||||
|
||||
if (item->GetVnum() >= 80003 && item->GetVnum() <= 80007)
|
||||
{
|
||||
LogManager::instance().GoldBarLog(ch->GetPlayerID(), item->GetID(), PERSONAL_SHOP_BUY, "");
|
||||
}
|
||||
|
||||
DBManager::instance().SendMoneyLog(MONEY_LOG_SHOP, item->GetVnum(), -dwPrice);
|
||||
|
||||
if (item)
|
||||
sys_log(0, "ShopEx: BUY: name %s %s(x %d):%u price %u", ch->GetName(), item->GetName(), item->GetCount(), item->GetID(), dwPrice);
|
||||
|
||||
// and add under, this:
|
||||
|
||||
#ifdef ENABLE_QUEST_RECEIVE_ITEM
|
||||
ch->SenderRecvItem(ch->GetPlayerID(), item);
|
||||
#endif
|
||||
Reference in New Issue
Block a user