Forums WoW Modding Support Archives WoWModding Threads [DiscordArchive] I'm currently working on implementing a death d...

[DiscordArchive] I'm currently working on implementing a death d...

[DiscordArchive] I'm currently working on implementing a death d...

rektbyfaith
Administrator
0
05-06-2025, 03:04 PM
#1
Archived author: Needle • Posted: 2025-05-06T15:04:39.836000+00:00
Original source

rektbyfaith
05-06-2025, 03:04 PM #1

Archived author: Needle • Posted: 2025-05-06T15:04:39.836000+00:00
Original source

rektbyfaith
Administrator
0
05-06-2025, 03:04 PM
#2
Archived author: Needle • Posted: 2025-05-06T15:04:40.735000+00:00
Original source

Thread automatically created by Mehh in <#415944535718494208>
rektbyfaith
05-06-2025, 03:04 PM #2

Archived author: Needle • Posted: 2025-05-06T15:04:40.735000+00:00
Original source

Thread automatically created by Mehh in <#415944535718494208>

rektbyfaith
Administrator
0
05-06-2025, 07:45 PM
#3
Archived author: Kaev • Posted: 2025-05-06T19:45:37.175000+00:00
Original source

I started to work on the exact same thing once in TSWoW. I didn't finish it but i can share you what i've researched and done so far for the client side.

For the client interface stuff i reused the available static popup dialog things which are also used for the usual duel dialogs.
- Inject a new UnitPopupButton with index `MAKGORA` into `_G["UnitPopupButtons"]`
- Inject the new menu entry item `MAKGORA` into `_G["UnitPopupMenus"]`, right after the menu entry item `DUEL`
- Inject a new popup dialog with id `MAKGORA_REQUEST` into `_G["StaticPopupDialogs"]`. This is where you can define the logic for accepting/declining the makgora request
- overwrite the existing implementation of `_G["UnitPopup_OnClick"]` to check for my `MAKGORA` button click. Here you can define the logic for sending the initial makgora request. If self.value is not `MAKGORA`, you can call the initial implementation of `UnitPopup_OnClick` (save that in a variable and just give the self argument into it)

That's it to get the most basic things done. Just search the variable names that i've used in the global lua stack like `StaticPopupDialogs` in the WoW 3.3.5 interface code and you will figure out how this works pretty fast.

With TSWoW i'd send custom packets to the server where i handle the makgora stuff. If you don't use TSWoW and don't have any other way to implement custom packets, your best way to seperate this is probably addon messages.

For the serverside you'd react on the packets/message of your choice and either reuse the existing duel system like you did or implement an own makgora system for it. I haven't looked into this part yet so i can't really say what i'd prefer but i'd probably modify the existing duel system and differentiate between the two duel types in the logic handlers of it.
rektbyfaith
05-06-2025, 07:45 PM #3

Archived author: Kaev • Posted: 2025-05-06T19:45:37.175000+00:00
Original source

I started to work on the exact same thing once in TSWoW. I didn't finish it but i can share you what i've researched and done so far for the client side.

For the client interface stuff i reused the available static popup dialog things which are also used for the usual duel dialogs.
- Inject a new UnitPopupButton with index `MAKGORA` into `_G["UnitPopupButtons"]`
- Inject the new menu entry item `MAKGORA` into `_G["UnitPopupMenus"]`, right after the menu entry item `DUEL`
- Inject a new popup dialog with id `MAKGORA_REQUEST` into `_G["StaticPopupDialogs"]`. This is where you can define the logic for accepting/declining the makgora request
- overwrite the existing implementation of `_G["UnitPopup_OnClick"]` to check for my `MAKGORA` button click. Here you can define the logic for sending the initial makgora request. If self.value is not `MAKGORA`, you can call the initial implementation of `UnitPopup_OnClick` (save that in a variable and just give the self argument into it)

That's it to get the most basic things done. Just search the variable names that i've used in the global lua stack like `StaticPopupDialogs` in the WoW 3.3.5 interface code and you will figure out how this works pretty fast.

With TSWoW i'd send custom packets to the server where i handle the makgora stuff. If you don't use TSWoW and don't have any other way to implement custom packets, your best way to seperate this is probably addon messages.

For the serverside you'd react on the packets/message of your choice and either reuse the existing duel system like you did or implement an own makgora system for it. I haven't looked into this part yet so i can't really say what i'd prefer but i'd probably modify the existing duel system and differentiate between the two duel types in the logic handlers of it.

rektbyfaith
Administrator
0
05-06-2025, 07:48 PM
#4
Archived author: Kaev • Posted: 2025-05-06T19:48:16.647000+00:00
Original source

This is my typescript code for TSWoW but you should be able to reimplement this in Lua fairly quickly, especially after checking out Blizzards implementation of it:
```typescript
interface UnitPopupButton {
text: string;
dist: number;
space?: number;
}

interface StaticPopupDialog {
// Core
/** The text shown in the dialog */
text: string;
/** Text for first button */
button1: string;
/** Text for second button */
button2?: string;
/** Text for third button */
button3?: string;
/** Sound file */
sound?: string;
/** Time before dialog auto-closes (0 for no timeout) */
timeout: number;
/** Can show while player is dead */
whileDead?: boolean;
/** Close when ESC pressed */
hideOnEscape?: boolean;
/** Close other popups when shown */
exclusive?: boolean;

// Input related
/** Shows an edit box */
hasEditBox?: boolean;
/** Max characters in edit box */
maxLetters?: number;
/** Max bytes in edit box */
maxBytes?: number;
/** Shows money display */
hasMoneyFrame?: boolean;
/** Shows money input fields */
hasMoneyInputFrame?: boolean;
/** Shows item icon/info */
hasItemFrame?: boolean;
/** Shows wider edit box */
hasWideEditBox?: boolean;

// Visual options
/** Shows alert icon */
showAlert?: boolean;
/** Shows gear alert icon */
showAlertGear?: boolean;
/** Shows close X button */
closeButton?: boolean;
/** Can show during cinematics */
interruptCinematic?: boolean;
/** Can't be closed by logging out */
notClosableByLogout?: boolean;
/** Condition for button2 */
DisplayButton2?: Function;
/** Condition for button3 */
DisplayButton3?: Function;

// Callbacks
/** Function called when button1 clicked */
OnAccept?: Function;
/** Function called when button2 clicked or dialog cancelled */
OnCancel?: Function;
/** Function called when button3 clicked */
OnAlt?: Function;
/** Function called when dialog shown */
OnShow?: Function;
/** Function called when dialog hidden */
OnHide?: Function;
/** Function called each frame */
OnUpdate?: Function;

// Edit box behavior
EditBoxOnEnterPressed?: Function;
EditBoxOnEscapePressed?: Function;
EditBoxOnTextChanged?: Function;
autoCompleteParams?: boolean;
autoCompleteRegex?: string;

}

const unitPopupButtons = _G["UnitPopupButtons"] as UnitPopupButton[];
const unitPopupMenus = _G["UnitPopupMenus"] as { [key: string] : string[] };
const staticPopupDialogs = _G["StaticPopupDialogs"] as { [key: string] : StaticPopupDialog };
const StaticPopup_Show = _G["StaticPopup_Show"] as (
which: string,
text_arg1?: string | number,
text_arg2?: string | number,
data?: any
) => void;
const UnitPopupOnClick = _G["UnitPopup_OnClick"] as Function;

unitPopupButtons["MAKGORA"] = {
text: "Mak'gora",
dist: 3,
space: 1
} as UnitPopupButton;

const playerMenu = unitPopupMenus["PLAYER"];
const duelIndex = playerMenu.indexOf("DUEL");
if (duelIndex !== -1) {
playerMenu.splice(duelIndex + 1, 0, "MAKGORA");
}

staticPopupDialogs['MAKGORA_REQUEST'] = {
text: "Mak'gora Request",
button1: ACCEPT,
button2: DECLINE,
sound: "igPlayerInvite",
OnAccept: function() {
// send request accepted packet
},
OnCancel: function() {
// send request declined packet
},
timeout: 60,
hideOnEscape: true
};

// Overwrite UnitPopup_OnClick to extend it with our Mak'gora logic
_G["UnitPopup_OnClick"] = function(self: any) {
const button = self.value;
if (button === "MAKGORA") {
StaticPopup_Show("MAKGORA_REQUEST"); // Testing code, probably do an own safety popup here to ask if the player really wants to duel to death
PlaySound("UChatScrollButton");
return;
}

// Call original function for all other cases
UnitPopupOnClick(self);
};
```
rektbyfaith
05-06-2025, 07:48 PM #4

Archived author: Kaev • Posted: 2025-05-06T19:48:16.647000+00:00
Original source

This is my typescript code for TSWoW but you should be able to reimplement this in Lua fairly quickly, especially after checking out Blizzards implementation of it:
```typescript
interface UnitPopupButton {
text: string;
dist: number;
space?: number;
}

interface StaticPopupDialog {
// Core
/** The text shown in the dialog */
text: string;
/** Text for first button */
button1: string;
/** Text for second button */
button2?: string;
/** Text for third button */
button3?: string;
/** Sound file */
sound?: string;
/** Time before dialog auto-closes (0 for no timeout) */
timeout: number;
/** Can show while player is dead */
whileDead?: boolean;
/** Close when ESC pressed */
hideOnEscape?: boolean;
/** Close other popups when shown */
exclusive?: boolean;

// Input related
/** Shows an edit box */
hasEditBox?: boolean;
/** Max characters in edit box */
maxLetters?: number;
/** Max bytes in edit box */
maxBytes?: number;
/** Shows money display */
hasMoneyFrame?: boolean;
/** Shows money input fields */
hasMoneyInputFrame?: boolean;
/** Shows item icon/info */
hasItemFrame?: boolean;
/** Shows wider edit box */
hasWideEditBox?: boolean;

// Visual options
/** Shows alert icon */
showAlert?: boolean;
/** Shows gear alert icon */
showAlertGear?: boolean;
/** Shows close X button */
closeButton?: boolean;
/** Can show during cinematics */
interruptCinematic?: boolean;
/** Can't be closed by logging out */
notClosableByLogout?: boolean;
/** Condition for button2 */
DisplayButton2?: Function;
/** Condition for button3 */
DisplayButton3?: Function;

// Callbacks
/** Function called when button1 clicked */
OnAccept?: Function;
/** Function called when button2 clicked or dialog cancelled */
OnCancel?: Function;
/** Function called when button3 clicked */
OnAlt?: Function;
/** Function called when dialog shown */
OnShow?: Function;
/** Function called when dialog hidden */
OnHide?: Function;
/** Function called each frame */
OnUpdate?: Function;

// Edit box behavior
EditBoxOnEnterPressed?: Function;
EditBoxOnEscapePressed?: Function;
EditBoxOnTextChanged?: Function;
autoCompleteParams?: boolean;
autoCompleteRegex?: string;

}

const unitPopupButtons = _G["UnitPopupButtons"] as UnitPopupButton[];
const unitPopupMenus = _G["UnitPopupMenus"] as { [key: string] : string[] };
const staticPopupDialogs = _G["StaticPopupDialogs"] as { [key: string] : StaticPopupDialog };
const StaticPopup_Show = _G["StaticPopup_Show"] as (
which: string,
text_arg1?: string | number,
text_arg2?: string | number,
data?: any
) => void;
const UnitPopupOnClick = _G["UnitPopup_OnClick"] as Function;

unitPopupButtons["MAKGORA"] = {
text: "Mak'gora",
dist: 3,
space: 1
} as UnitPopupButton;

const playerMenu = unitPopupMenus["PLAYER"];
const duelIndex = playerMenu.indexOf("DUEL");
if (duelIndex !== -1) {
playerMenu.splice(duelIndex + 1, 0, "MAKGORA");
}

staticPopupDialogs['MAKGORA_REQUEST'] = {
text: "Mak'gora Request",
button1: ACCEPT,
button2: DECLINE,
sound: "igPlayerInvite",
OnAccept: function() {
// send request accepted packet
},
OnCancel: function() {
// send request declined packet
},
timeout: 60,
hideOnEscape: true
};

// Overwrite UnitPopup_OnClick to extend it with our Mak'gora logic
_G["UnitPopup_OnClick"] = function(self: any) {
const button = self.value;
if (button === "MAKGORA") {
StaticPopup_Show("MAKGORA_REQUEST"); // Testing code, probably do an own safety popup here to ask if the player really wants to duel to death
PlaySound("UChatScrollButton");
return;
}

// Call original function for all other cases
UnitPopupOnClick(self);
};
```

rektbyfaith
Administrator
0
05-06-2025, 07:54 PM
#5
Archived author: Kaev • Posted: 2025-05-06T19:54:22.638000+00:00
Original source

As said before, it's not finished, but a solid base to work with for the client part Hope it helps, good luck
rektbyfaith
05-06-2025, 07:54 PM #5

Archived author: Kaev • Posted: 2025-05-06T19:54:22.638000+00:00
Original source

As said before, it's not finished, but a solid base to work with for the client part Hope it helps, good luck

rektbyfaith
Administrator
0
05-07-2025, 07:33 AM
#6
Archived author: TwilightQora • Posted: 2025-05-07T07:33:28.994000+00:00
Original source

Tysm for the help and information. Have a good day
rektbyfaith
05-07-2025, 07:33 AM #6

Archived author: TwilightQora • Posted: 2025-05-07T07:33:28.994000+00:00
Original source

Tysm for the help and information. Have a good day

Recently Browsing
 1 Guest(s)
Recently Browsing
 1 Guest(s)