mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-12 17:51:28 +00:00
Merge pull request #1076 from KinglyKrab/zone
Add new zone methods to Perl/Lua.
This commit is contained in:
commit
10f54313a5
@ -530,6 +530,32 @@ XS(XS__zone) {
|
||||
XSRETURN_EMPTY;
|
||||
}
|
||||
|
||||
XS(XS__zonegroup);
|
||||
XS(XS__zonegroup) {
|
||||
dXSARGS;
|
||||
if (items != 1)
|
||||
Perl_croak(aTHX_ "Usage: quest::zonegroup(string zone_name)");
|
||||
|
||||
char *zone_name = (char *) SvPV_nolen(ST(0));
|
||||
|
||||
quest_manager.ZoneGroup(zone_name);
|
||||
|
||||
XSRETURN_EMPTY;
|
||||
}
|
||||
|
||||
XS(XS__zoneraid);
|
||||
XS(XS__zoneraid) {
|
||||
dXSARGS;
|
||||
if (items != 1)
|
||||
Perl_croak(aTHX_ "Usage: quest::zoneraid(string zone_name)");
|
||||
|
||||
char *zone_name = (char *) SvPV_nolen(ST(0));
|
||||
|
||||
quest_manager.ZoneRaid(zone_name);
|
||||
|
||||
XSRETURN_EMPTY;
|
||||
}
|
||||
|
||||
XS(XS__settimer);
|
||||
XS(XS__settimer) {
|
||||
dXSARGS;
|
||||
@ -4520,6 +4546,8 @@ EXTERN_C XS(boot_quest) {
|
||||
newXS(strcpy(buf, "write"), XS__write, file);
|
||||
newXS(strcpy(buf, "ze"), XS__ze, file);
|
||||
newXS(strcpy(buf, "zone"), XS__zone, file);
|
||||
newXS(strcpy(buf, "zonegroup"), XS__zonegroup, file);
|
||||
newXS(strcpy(buf, "zoneraid"), XS__zoneraid, file);
|
||||
|
||||
XSRETURN_YES;
|
||||
}
|
||||
|
||||
@ -1146,6 +1146,18 @@ Lua_EntityList lua_get_entity_list() {
|
||||
return Lua_EntityList(&entity_list);
|
||||
}
|
||||
|
||||
void lua_zone(const char* zone_name) {
|
||||
quest_manager.Zone(zone_name);
|
||||
}
|
||||
|
||||
void lua_zone_group(const char* zone_name) {
|
||||
quest_manager.ZoneGroup(zone_name);
|
||||
}
|
||||
|
||||
void lua_zone_raid(const char* zone_name) {
|
||||
quest_manager.ZoneRaid(zone_name);
|
||||
}
|
||||
|
||||
int lua_get_zone_id() {
|
||||
if(!zone)
|
||||
return 0;
|
||||
@ -1893,6 +1905,9 @@ luabind::scope lua_register_general() {
|
||||
luabind::def("get_qglobals", (luabind::adl::object(*)(lua_State*,Lua_NPC))&lua_get_qglobals),
|
||||
luabind::def("get_qglobals", (luabind::adl::object(*)(lua_State*))&lua_get_qglobals),
|
||||
luabind::def("get_entity_list", &lua_get_entity_list),
|
||||
luabind::def("zone", &lua_zone),
|
||||
luabind::def("zone_group", &lua_zone_group),
|
||||
luabind::def("zone_raid", &lua_zone_raid),
|
||||
luabind::def("get_zone_id", &lua_get_zone_id),
|
||||
luabind::def("get_zone_long_name", &lua_get_zone_long_name),
|
||||
luabind::def("get_zone_short_name", &lua_get_zone_short_name),
|
||||
|
||||
@ -407,6 +407,84 @@ void QuestManager::Zone(const char *zone_name) {
|
||||
}
|
||||
}
|
||||
|
||||
void QuestManager::ZoneGroup(const char *zone_name) {
|
||||
QuestManagerCurrentQuestVars();
|
||||
if (initiator && initiator->IsClient()) {
|
||||
if (!initiator->GetGroup()) {
|
||||
auto pack = new ServerPacket(ServerOP_ZoneToZoneRequest, sizeof(ZoneToZone_Struct));
|
||||
ZoneToZone_Struct* ztz = (ZoneToZone_Struct*) pack->pBuffer;
|
||||
ztz->response = 0;
|
||||
ztz->current_zone_id = zone->GetZoneID();
|
||||
ztz->current_instance_id = zone->GetInstanceID();
|
||||
ztz->requested_zone_id = database.GetZoneID(zone_name);
|
||||
ztz->admin = initiator->Admin();
|
||||
strcpy(ztz->name, initiator->GetName());
|
||||
ztz->guild_id = initiator->GuildID();
|
||||
ztz->ignorerestrictions = 3;
|
||||
worldserver.SendPacket(pack);
|
||||
safe_delete(pack);
|
||||
} else {
|
||||
auto client_group = initiator->GetGroup();
|
||||
for (int member_index = 0; member_index < MAX_GROUP_MEMBERS; member_index++) {
|
||||
if (client_group->members[member_index] && client_group->members[member_index]->IsClient()) {
|
||||
auto group_member = client_group->members[member_index]->CastToClient();
|
||||
auto pack = new ServerPacket(ServerOP_ZoneToZoneRequest, sizeof(ZoneToZone_Struct));
|
||||
ZoneToZone_Struct* ztz = (ZoneToZone_Struct*) pack->pBuffer;
|
||||
ztz->response = 0;
|
||||
ztz->current_zone_id = zone->GetZoneID();
|
||||
ztz->current_instance_id = zone->GetInstanceID();
|
||||
ztz->requested_zone_id = database.GetZoneID(zone_name);
|
||||
ztz->admin = group_member->Admin();
|
||||
strcpy(ztz->name, group_member->GetName());
|
||||
ztz->guild_id = group_member->GuildID();
|
||||
ztz->ignorerestrictions = 3;
|
||||
worldserver.SendPacket(pack);
|
||||
safe_delete(pack);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void QuestManager::ZoneRaid(const char *zone_name) {
|
||||
QuestManagerCurrentQuestVars();
|
||||
if (initiator && initiator->IsClient()) {
|
||||
if (!initiator->GetRaid()) {
|
||||
auto pack = new ServerPacket(ServerOP_ZoneToZoneRequest, sizeof(ZoneToZone_Struct));
|
||||
ZoneToZone_Struct* ztz = (ZoneToZone_Struct*) pack->pBuffer;
|
||||
ztz->response = 0;
|
||||
ztz->current_zone_id = zone->GetZoneID();
|
||||
ztz->current_instance_id = zone->GetInstanceID();
|
||||
ztz->requested_zone_id = database.GetZoneID(zone_name);
|
||||
ztz->admin = initiator->Admin();
|
||||
strcpy(ztz->name, initiator->GetName());
|
||||
ztz->guild_id = initiator->GuildID();
|
||||
ztz->ignorerestrictions = 3;
|
||||
worldserver.SendPacket(pack);
|
||||
safe_delete(pack);
|
||||
} else {
|
||||
auto client_raid = initiator->GetRaid();
|
||||
for (int member_index = 0; member_index < MAX_RAID_MEMBERS; member_index++) {
|
||||
if (client_raid->members[member_index].member && client_raid->members[member_index].member->IsClient()) {
|
||||
auto raid_member = client_raid->members[member_index].member->CastToClient();
|
||||
auto pack = new ServerPacket(ServerOP_ZoneToZoneRequest, sizeof(ZoneToZone_Struct));
|
||||
ZoneToZone_Struct* ztz = (ZoneToZone_Struct*) pack->pBuffer;
|
||||
ztz->response = 0;
|
||||
ztz->current_zone_id = zone->GetZoneID();
|
||||
ztz->current_instance_id = zone->GetInstanceID();
|
||||
ztz->requested_zone_id = database.GetZoneID(zone_name);
|
||||
ztz->admin = raid_member->Admin();
|
||||
strcpy(ztz->name, raid_member->GetName());
|
||||
ztz->guild_id = raid_member->GuildID();
|
||||
ztz->ignorerestrictions = 3;
|
||||
worldserver.SendPacket(pack);
|
||||
safe_delete(pack);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void QuestManager::settimer(const char *timer_name, int seconds) {
|
||||
QuestManagerCurrentQuestVars();
|
||||
|
||||
|
||||
@ -77,6 +77,8 @@ public:
|
||||
void selfcast(int spell_id);
|
||||
void addloot(int item_id, int charges = 0, bool equipitem = true, int aug1 = 0, int aug2 = 0, int aug3 = 0, int aug4 = 0, int aug5 = 0, int aug6 = 0);
|
||||
void Zone(const char *zone_name);
|
||||
void ZoneGroup(const char *zone_name);
|
||||
void ZoneRaid(const char *zone_name);
|
||||
void settimer(const char *timer_name, int seconds);
|
||||
void settimerMS(const char *timer_name, int milliseconds);
|
||||
void settimerMS(const char *timer_name, int milliseconds, EQ::ItemInstance *inst);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user