Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- string DlgGetInformationOverview(object oPC)
- {
- string sOverview;
- int x = 1;
- object oArea = GetArea(OBJECT_SELF);
- // housing information -----------------------------------------------------
- string sNPCHouse = GetLocalString(OBJECT_SELF,"HOUSE");
- string sHouseTag = GetLocalString(GetArea(OBJECT_SELF),"HOUSE");
- // Does the NPC take care of a house?
- if(sNPCHouse!="")
- {
- object oHouse = GetWaypointByTag(sNPCHouse);
- // not in housing
- if(sHouseTag=="")
- {
- }
- // we are in the NPC's establishment
- else if(sNPCHouse==sHouseTag)
- {
- if( !GetRoomOccupiedByPC(sNPCHouse, oPC) )
- {
- string sKeeperTitle = GetLocalString(oHouse, "KEEPER_TITLE");
- if(sKeeperTitle=="")
- sKeeperTitle = "the head of the house";
- else
- sKeeperTitle = "the "+sKeeperTitle;
- // this NPC can't rent rooms, so directs the PC to the keeper for info about the place
- if(!GetLocalInt(OBJECT_SELF,"HOUSE_KEEPER"))
- {
- string sKeeper = HousingGetKeeperName(oHouse);
- if(sKeeper=="")
- sKeeper = sKeeperTitle;
- else
- sKeeper += ", "+sKeeperTitle;
- sOverview += "You are in "+GetName(oHouse)+". For more information, talk to "+sKeeper+". ";
- }
- // the NPC is the keeper
- else
- {
- sOverview += "You are in "+GetName(oHouse)+". I am "+sKeeperTitle+". ";
- }
- }
- }
- }
- // is the PC in a place that has rooms?
- else if(sHouseTag!="")
- {
- // if the PC is not staying here, point them to the house keeper
- if( !GetRoomOccupiedByPC(sHouseTag, oPC) )
- {
- object oHouse = GetWaypointByTag(sHouseTag);
- string sKeeperTitle = GetLocalString(oHouse, "KEEPER_TITLE");
- if(sKeeperTitle=="")
- sKeeperTitle = "the head of the house";
- else
- sKeeperTitle = "the "+sKeeperTitle;
- string sKeeper = HousingGetKeeperName(oHouse);
- if(sKeeper=="")
- sKeeper = sKeeperTitle;
- else
- sKeeper += ", "+sKeeperTitle;
- sOverview += "If you want lodging in "+GetName(oHouse)+", speak to "+sKeeper+". ";
- }
- }
- else
- {
- // we are not in "housing", lets look for Public Housing in an adjacent area
- object oHouse, oDest, oDestArea;
- object oTrans = GetFirstObjectInArea(oArea);
- while(GetIsObjectValid(oTrans))
- {
- oDest = GetTransitionTarget(oTrans);
- if(oDest!=OBJECT_INVALID)
- {
- oDestArea = GetArea(oDest);
- if(oDestArea!=oArea)
- {
- sHouseTag = GetLocalString(oDestArea,"HOUSE");
- if(sHouseTag!="")
- {
- oHouse = GetWaypointByTag(sHouseTag);
- if(GetLocalInt(oHouse,"HOUSE_PRIVATE"))
- oHouse = OBJECT_INVALID;
- else
- break;
- }
- }
- }
- oTrans = GetNextObjectInArea(oArea);
- }
- if( oHouse!=OBJECT_INVALID )
- {
- sOverview += GetName(oHouse) +" "+ DlgGetLocationDescription(oDest) + "offers lodging.";
- }
- }
- // merchant search ---------------------------------------------------------
- string sNPC;
- object oMerch;
- object oTemp = GetNearestCreature(CREATURE_TYPE_IS_ALIVE, TRUE, OBJECT_SELF, x);
- while( oTemp!=OBJECT_INVALID
- && GetArea(oTemp)==oArea
- )
- {
- if(GetLocalInt(oTemp,"MERCH"))
- {
- oMerch = oTemp;
- sNPC = GetName(oMerch)+" ";
- if(GetSharesGroupMembership(oMerch))
- break;
- }
- oTemp = GetNearestCreature(CREATURE_TYPE_IS_ALIVE, TRUE, OBJECT_SELF, ++x);
- }
- if(sNPC!="")
- {
- if(sOverview!="")
- sOverview += BR+BR;
- sOverview += sNPC
- + DlgGetLocationDescription(oMerch)
- ;
- string sGoods = GetLocalString(oMerch, "MERCH_STORE1_DESCRIPTION");
- if(sGoods!="")
- sOverview += "trades in "+sGoods+".";
- else
- {
- sGoods = GetLocalString(oMerch, "MERCH_STORE1_NAME");
- if(sGoods!="")
- sOverview += "has a store named "+sGoods+".";
- else
- sOverview += "conducts trade.";
- }
- }
- // lack of information response
- if(sOverview=="")
- sOverview = GetLocalString(OBJECT_SELF,"DIALOG_INFO_NONE");
- if(sOverview=="")
- sOverview = "*Provides no useful information.*";
- return sOverview;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement