mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-12 01:11:29 +00:00
Exported client functions to lua, going to work on npc next
This commit is contained in:
parent
79a9d2112a
commit
850fa5aecc
@ -7720,3 +7720,52 @@ void Client::TryItemTick(int slot)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Client::RefundAA() {
|
||||
int cur = 0;
|
||||
bool refunded = false;
|
||||
|
||||
for(int x = 0; x < aaHighestID; x++) {
|
||||
cur = GetAA(x);
|
||||
if(cur > 0){
|
||||
SendAA_Struct* curaa = zone->FindAA(x);
|
||||
if(cur){
|
||||
SetAA(x, 0);
|
||||
for(int j = 0; j < cur; j++) {
|
||||
m_pp.aapoints += curaa->cost + (curaa->cost_inc * j);
|
||||
refunded = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_pp.aapoints += cur;
|
||||
SetAA(x, 0);
|
||||
refunded = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(refunded) {
|
||||
Save();
|
||||
Kick();
|
||||
}
|
||||
}
|
||||
|
||||
void Client::IncrementAA(int aa_id) {
|
||||
SendAA_Struct* aa2 = zone->FindAA(aa_id);
|
||||
|
||||
if(aa2 == nullptr)
|
||||
return;
|
||||
|
||||
if(GetAA(aa_id) == aa2->max_level)
|
||||
return;
|
||||
|
||||
SetAA(aa_id, GetAA(aa_id) + 1);
|
||||
|
||||
Save();
|
||||
|
||||
SendAA(aa_id);
|
||||
SendAATable();
|
||||
SendAAStats();
|
||||
CalcBonuses();
|
||||
}
|
||||
|
||||
@ -750,6 +750,12 @@ public:
|
||||
inline uint32 GetAAPointsSpent() { return m_pp.aapoints_spent; }
|
||||
int16 CalcAAFocusEffect(focusType type, uint16 focus_spell, uint16 spell_id);
|
||||
int16 CalcAAFocus(focusType type, uint32 aa_ID, uint16 spell_id);
|
||||
void SetAAPoints(uint32 points) { m_pp.aapoints = points; SendAAStats(); }
|
||||
void AddAAPoints(uint32 points) { m_pp.aapoints += points; SendAAStats(); }
|
||||
int GetAAPoints() { return m_pp.aapoints; }
|
||||
int GetSpentAA() { return m_pp.aapoints_spent; }
|
||||
void RefundAA();
|
||||
void IncrementAA(int aa_id);
|
||||
|
||||
int16 acmod();
|
||||
|
||||
@ -1015,6 +1021,9 @@ public:
|
||||
void DepopAllCorpses();
|
||||
void DepopPlayerCorpse(uint32 dbid);
|
||||
void BuryPlayerCorpses();
|
||||
uint32 GetCorpseCount() { return database.GetPlayerCorpseCount(CharacterID()); }
|
||||
uint32 GetCorpseID(int corpse) { return database.GetPlayerCorpseID(CharacterID(), corpse); }
|
||||
uint32 GetCorpseItemAt(int corpse_id, int slot_id) { return database.GetPlayerCorpseItemAt(corpse_id, slot_id); }
|
||||
void SuspendMinion();
|
||||
void Doppelganger(uint16 spell_id, Mob *target, const char *name_override, int pet_count, int pet_duration);
|
||||
void NotifyNewTitlesAvailable();
|
||||
|
||||
@ -8650,9 +8650,7 @@ void command_altactivate(Client *c, const Seperator *sep){
|
||||
|
||||
void command_refundaa(Client *c, const Seperator *sep){
|
||||
Client* refundee = nullptr;
|
||||
int curpt = 0;
|
||||
bool refunded = false;
|
||||
if(c){
|
||||
if(c) {
|
||||
if(c->GetTarget()){
|
||||
if(c->GetTarget()->IsClient())
|
||||
refundee = c->GetTarget()->CastToClient();
|
||||
@ -8663,32 +8661,10 @@ void command_refundaa(Client *c, const Seperator *sep){
|
||||
c->Message(0, "You must have a target selected.");
|
||||
}
|
||||
|
||||
if(refundee){
|
||||
for(int x1=0;x1<aaHighestID;x1++){
|
||||
curpt = refundee->GetAA(x1);
|
||||
if(curpt > 0){
|
||||
SendAA_Struct* curaa = zone->FindAA(x1);
|
||||
if(curaa){
|
||||
refundee->SetAA(x1, 0);
|
||||
for(int x2=0;x2<curpt;x2++){ //add up all the AA points pt by pt to get the correct cost
|
||||
refundee->GetPP().aapoints += curaa->cost + (curaa->cost_inc * x2);
|
||||
refunded = true;
|
||||
}
|
||||
}
|
||||
else //aa doesn't exist.. but if they bought it then it had at least a cost of 1 point each
|
||||
{ //so give back what we can
|
||||
refundee->GetPP().aapoints += curpt;
|
||||
refundee->SetAA(x1, 0);
|
||||
refunded = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(refundee) {
|
||||
refundee->RefundAA();
|
||||
}
|
||||
}
|
||||
if(refunded){
|
||||
refundee->Save(); //save of course
|
||||
refundee->Kick(); //client gets all buggy if we don't immediatly relog so just force it on them
|
||||
}
|
||||
}
|
||||
|
||||
void command_traindisc(Client *c, const Seperator *sep)
|
||||
|
||||
1166
zone/lua_client.cpp
1166
zone/lua_client.cpp
File diff suppressed because it is too large
Load Diff
@ -30,10 +30,8 @@ public:
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
/*
|
||||
void SendSound();
|
||||
void Save();
|
||||
void Save(bool commit_now);
|
||||
void Save(int commit_now = 0);
|
||||
void SaveBackup();
|
||||
bool Connected();
|
||||
bool InZone();
|
||||
@ -52,9 +50,9 @@ public:
|
||||
void SetBaseRace(int v);
|
||||
void SetBaseGender(int v);
|
||||
int GetBaseFace();
|
||||
int GetLanguageSkill();
|
||||
int GetLastName();
|
||||
int GetLDoNPointsTheme();
|
||||
int GetLanguageSkill(int skill_id);
|
||||
const char *GetLastName();
|
||||
int GetLDoNPointsTheme(int theme);
|
||||
int GetBaseSTR();
|
||||
int GetBaseSTA();
|
||||
int GetBaseCHA();
|
||||
@ -70,7 +68,7 @@ public:
|
||||
void SetDeity(int v);
|
||||
void AddEXP(uint32 add_exp, int conlevel = 255, bool resexp = false);
|
||||
void SetEXP(uint32 set_exp, uint32 set_aaxp, bool resexp = false);
|
||||
SetBindPoint(int to_zone = -1, float new_x = 0.0f, float new_y = 0.0f, float new_z = 0.0f);
|
||||
void SetBindPoint(int to_zone = -1, float new_x = 0.0f, float new_y = 0.0f, float new_z = 0.0f);
|
||||
float GetBindX(int index = 0);
|
||||
float GetBindY(int index = 0);
|
||||
float GetBindZ(int index = 0);
|
||||
@ -79,24 +77,25 @@ public:
|
||||
void MovePC(int zone, float x, float y, float z, float heading);
|
||||
void MovePCInstance(int zone, int instance, float x, float y, float z, float heading);
|
||||
void ChangeLastName(const char *in);
|
||||
int GetFactionLevel(uint32 char_id, uint32 npc_id, uint32 race, uint32 class, uint32 deity, uint32 faction, Lua_NPC npc);
|
||||
int GetFactionLevel(uint32 char_id, uint32 npc_id, uint32 race, uint32 class_, uint32 deity, uint32 faction, Lua_NPC npc);
|
||||
void SetFactionLevel(uint32 char_id, uint32 npc_id, int char_class, int char_race, int char_deity);
|
||||
void SetFactionLevel2(uint32 char_id, int faction_id, int char_class, int char_race, int char_deity, int value, int temp);
|
||||
int GetRawItemAC();
|
||||
uint32 AccountID();
|
||||
const char *AccountName();
|
||||
bool Admin();
|
||||
int Admin();
|
||||
uint32 CharacterID();
|
||||
int GuildRank();
|
||||
uint32 GuildID();
|
||||
int GetFace();
|
||||
|
||||
bool TakeMoneyFromPP(uint64 copper, bool update_client = false);
|
||||
void AddMoneyToPP(uint32 copper, uint32 silver, uint32 gold, uint32 platinum, bool update_client = false);
|
||||
bool TGB();
|
||||
int GetSkillPoints();
|
||||
void SetSkillPoints(int skill);
|
||||
void IncreaseSkill(int skill_id, int value);
|
||||
void IncreaseLanguageSkill(int skill_id, int value);
|
||||
void IncreaseSkill(int skill_id, int value = 1);
|
||||
void IncreaseLanguageSkill(int skill_id, int value = 1);
|
||||
int GetRawSkill(int skill_id);
|
||||
bool HasSkill(int skill_id);
|
||||
bool CanHaveSkill(int skill_id);
|
||||
@ -105,11 +104,11 @@ public:
|
||||
void CheckSpecializeIncrease(int spell_id);
|
||||
void CheckIncreaseSkill(int skill_id, Lua_Mob target, int chance_mod = 0);
|
||||
void SetLanguageSkill(int language, int value);
|
||||
int MaxSkill(int spell_id);
|
||||
int MaxSkill(int skill_id);
|
||||
bool IsMedding();
|
||||
Lua_Client GetDuelTarget();
|
||||
int GetDuelTarget();
|
||||
bool IsDueling();
|
||||
void SetDuelTarget(Lua_Client c);
|
||||
void SetDuelTarget(int c);
|
||||
void SetDueling(bool v);
|
||||
void ResetAA();
|
||||
void MemSpell(int spell_id, int slot, bool update_client = true);
|
||||
@ -129,7 +128,7 @@ public:
|
||||
void NukeItem(uint32 item_num, int where_to_check);
|
||||
void SetTint(int slot_id, uint32 color);
|
||||
void SetMaterial(int slot_id, uint32 item_id);
|
||||
void Undye(int slot_id);
|
||||
void Undye();
|
||||
int GetItemIDAt(int slot_id);
|
||||
int GetAugmentIDAt(int slot_id, int aug_slot);
|
||||
void DeleteItemInInventory(int slot_id, int quantity, bool update_client = true);
|
||||
@ -137,7 +136,7 @@ public:
|
||||
uint32 aug5 = 0, bool attuned = false, int to_slot = 30);
|
||||
void SetStats(int type, int value);
|
||||
void IncStats(int type, int value);
|
||||
int DropItem(int slot_id);
|
||||
void DropItem(int slot_id);
|
||||
void BreakInvis();
|
||||
void LeaveGroup();
|
||||
bool IsGrouped();
|
||||
@ -181,7 +180,7 @@ public:
|
||||
uint32 GetPVPPoints();
|
||||
uint32 GetRadiantCrystals();
|
||||
uint32 GetEbonCrystals();
|
||||
void ReadBook(const char *text, int type);
|
||||
void QuestReadBook(const char *text, int type);
|
||||
void UpdateGroupAAs(int points, uint32 type);
|
||||
uint32 GetGroupPoints();
|
||||
uint32 GetRaidPoints();
|
||||
@ -191,18 +190,18 @@ public:
|
||||
int GetEndurancePercent();
|
||||
void SetEndurance(int endur);
|
||||
void SendOPTranslocateConfirm(Lua_Mob caster, int spell_id);
|
||||
const char *GetIP();
|
||||
uint32 GetIP();
|
||||
void AddLevelBasedExp(int exp_pct, int max_level = 0);
|
||||
void IncrementAA(int aa);
|
||||
MarkSingleCompassLoc(float in_x, float in_y, float in_z, int count = 1);
|
||||
int GetFreeSpellBookSlot(int start = 0);
|
||||
int GetSpellBookSlotBySpellID(int spell_id);
|
||||
void MarkSingleCompassLoc(float in_x, float in_y, float in_z, int count = 1);
|
||||
int GetNextAvailableSpellBookSlot(int start = 0);
|
||||
int FindSpellBookSlotBySpellID(int spell_id);
|
||||
void UpdateTaskActivity(int task, int activity, int count);
|
||||
void AssignTask(int task, int npc_id);
|
||||
void FailTask(int task);
|
||||
bool IsTaskCompleted(int task);
|
||||
bool IsTaskActive(int task);
|
||||
bool IsTaskActivityActive(int task, int activty);
|
||||
bool IsTaskActivityActive(int task, int activity);
|
||||
int GetCorpseCount();
|
||||
int GetCorpseID(int corpse);
|
||||
int GetCorpseItemAt(int corpse, int slot);
|
||||
@ -218,8 +217,9 @@ public:
|
||||
void SendWebLink(const char *site);
|
||||
bool HasSpellScribed(int spell_id);
|
||||
void SetAccountFlag(std::string flag, std::string val);
|
||||
std::string value GetAccountFlag(std::string flag);
|
||||
std::string GetAccountFlag(std::string flag);
|
||||
|
||||
/*
|
||||
//unsup features
|
||||
Lua_Group GetGroup();
|
||||
Lua_Raid GetRaid();
|
||||
|
||||
@ -10,10 +10,10 @@
|
||||
#include <stdio.h>
|
||||
#include <sstream>
|
||||
#include <vector>
|
||||
#include <algorithm>
|
||||
|
||||
#include "masterentity.h"
|
||||
#include "../common/spdat.h"
|
||||
#include "../common/seperator.h"
|
||||
#include "lua_entity.h"
|
||||
#include "lua_item.h"
|
||||
#include "lua_iteminst.h"
|
||||
@ -767,14 +767,7 @@ void LuaParser::LoadScript(std::string filename, std::string package_name) {
|
||||
}
|
||||
|
||||
bool LuaParser::HasFunction(std::string subname, std::string package_name) {
|
||||
size_t sz = subname.length();
|
||||
for(size_t i = 0; i < sz; ++i) {
|
||||
char c = subname[i];
|
||||
if(65 <= c && c <= 90) {
|
||||
c += 32;
|
||||
}
|
||||
subname[i] = c;
|
||||
}
|
||||
std::transform(subname.begin(), subname.end(), subname.begin(), ::tolower);
|
||||
|
||||
auto iter = loaded_.find(package_name);
|
||||
if(iter == loaded_.end()) {
|
||||
|
||||
@ -3940,8 +3940,7 @@ XS(XS_Client_SetAAPoints) {
|
||||
if(THIS == nullptr)
|
||||
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
|
||||
|
||||
THIS->GetPP().aapoints = points;
|
||||
THIS->SendAAStats();
|
||||
THIS->SetAAPoints(points);
|
||||
}
|
||||
XSRETURN_EMPTY;
|
||||
}
|
||||
@ -3965,7 +3964,7 @@ XS(XS_Client_GetAAPoints) {
|
||||
if(THIS == nullptr)
|
||||
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
|
||||
|
||||
RETVAL = THIS->GetPP().aapoints;
|
||||
RETVAL = THIS->GetAAPoints();
|
||||
XSprePUSH; PUSHu((UV)RETVAL);
|
||||
}
|
||||
XSRETURN(1);
|
||||
@ -3990,7 +3989,7 @@ XS(XS_Client_GetSpentAA) {
|
||||
if(THIS == nullptr)
|
||||
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
|
||||
|
||||
RETVAL = THIS->GetPP().aapoints_spent;
|
||||
RETVAL = THIS->GetSpentAA();
|
||||
XSprePUSH; PUSHu((UV)RETVAL);
|
||||
}
|
||||
XSRETURN(1);
|
||||
@ -4014,8 +4013,7 @@ XS(XS_Client_AddAAPoints) {
|
||||
if(THIS == nullptr)
|
||||
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
|
||||
|
||||
THIS->GetPP().aapoints += points;
|
||||
THIS->SendAAStats();
|
||||
THIS->AddAAPoints(points);
|
||||
}
|
||||
XSRETURN_EMPTY;
|
||||
}
|
||||
@ -4875,22 +4873,7 @@ XS(XS_Client_IncrementAA)
|
||||
if(THIS == nullptr)
|
||||
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
|
||||
|
||||
SendAA_Struct* aa2 = zone->FindAA(aaskillid);
|
||||
|
||||
if(aa2 == nullptr)
|
||||
Perl_croak(aTHX_ "Invalid AA.");
|
||||
|
||||
if(THIS->GetAA(aaskillid) == aa2->max_level)
|
||||
Perl_croak(aTHX_ "AA at Max already.");
|
||||
|
||||
THIS->SetAA(aaskillid, THIS->GetAA(aaskillid)+1);
|
||||
|
||||
THIS->Save();
|
||||
|
||||
THIS->SendAA(aaskillid);
|
||||
THIS->SendAATable();
|
||||
THIS->SendAAStats();
|
||||
THIS->CalcBonuses();
|
||||
THIS->IncrementAA(aaskillid);
|
||||
}
|
||||
XSRETURN_EMPTY;
|
||||
}
|
||||
@ -5205,7 +5188,7 @@ XS(XS_Client_GetCorpseCount)
|
||||
if(THIS == nullptr)
|
||||
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
|
||||
|
||||
RETVAL = database.GetPlayerCorpseCount(THIS->CharacterID());
|
||||
RETVAL = THIS->GetCorpseCount();
|
||||
XSprePUSH; PUSHi((IV)RETVAL);
|
||||
}
|
||||
XSRETURN(1);
|
||||
@ -5232,7 +5215,7 @@ XS(XS_Client_GetCorpseID)
|
||||
if(THIS == nullptr)
|
||||
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
|
||||
|
||||
RETVAL = database.GetPlayerCorpseID(THIS->CharacterID(), corpse);
|
||||
RETVAL = THIS->GetCorpseID(corpse);
|
||||
XSprePUSH; PUSHi((IV)RETVAL);
|
||||
}
|
||||
XSRETURN(1);
|
||||
@ -5260,7 +5243,7 @@ XS(XS_Client_GetCorpseItemAt)
|
||||
if(THIS == nullptr)
|
||||
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
|
||||
|
||||
RETVAL = database.GetPlayerCorpseItemAt(corpse_id, slotid);
|
||||
RETVAL = THIS->GetCorpseItemAt(corpse_id, slotid);
|
||||
XSprePUSH; PUSHi((IV)RETVAL);
|
||||
}
|
||||
XSRETURN(1);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user